Skip to content

Commit

Permalink
check clean
Browse files Browse the repository at this point in the history
  • Loading branch information
miquelcaceres committed Jul 22, 2024
1 parent 507ce1e commit e18edc6
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 17 deletions.
2 changes: 1 addition & 1 deletion .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@
CRAN-SUBMISSION
cran-comments.md
^CRAN-SUBMISSION$
^metadata\\.yml$
metadata.yml
featured.png
26 changes: 13 additions & 13 deletions R/parse_forestable.R
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@
f <- emptyforest()
if(is_tree) {
f$treeData <- tree |>
dplyr::select(sp_name, sp_code, dbh, height, density_factor) |>
dplyr::rename(Species = sp_name,
SpeciesCode = sp_code,
DBH = dbh,
Height = height,
N = density_factor) |>
dplyr::select(.data$sp_name, .data$sp_code, .data$dbh, .data$height, .data$density_factor) |>
dplyr::rename(Species = .data$sp_name,
SpeciesCode = .data$sp_code,
DBH = .data$dbh,
Height = .data$height,
N = .data$density_factor) |>
dplyr::mutate(DBH = as.numeric(DBH),
Height = as.numeric(Height)*100,
N = as.numeric(N)) |>
Expand Down Expand Up @@ -52,25 +52,25 @@
dplyr::filter(DBH >= minimumTreeDBH)
if(!keepSpeciesCodes) {
f$treeData <- f$treeData |>
dplyr::select(-SpeciesCode)
dplyr::select(-.data$SpeciesCode)
}
}
if(is_shrub) {
shrub <- understory$shrub[[1]]
f$shrubData <- shrub |>
dplyr::select(sp_name, sp_code, height, cover) |>
dplyr::rename(Species = sp_name,
SpeciesCode = sp_code,
Height = height,
Cover = cover) |>
dplyr::select(.data$sp_name, .data$sp_code, .data$height, cover) |>
dplyr::rename(Species = .data$sp_name,
SpeciesCode = .data$sp_code,
Height = .data$height,
Cover = .data$cover) |>
dplyr::mutate(Height = as.numeric(Height),
Cover = as.numeric(Cover),
Z50 = as.numeric(NA),
Z95 = as.numeric(NA))

if(!keepSpeciesCodes) {
f$shrubData <- f$shrubData |>
dplyr::select(-SpeciesCode)
dplyr::select(-.data$SpeciesCode)
}

}
Expand Down
10 changes: 7 additions & 3 deletions vignettes/PreparingInputs_I.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,14 @@ library(medfate)
library(medfateland)
library(ggplot2)
library(tidyterra)
library(forestables)
```

The first section, **A**, shows how to create the spatial inputs from forest inventory data in tree lists, which will be the general case. The second section, **B**, shows the differences that occur when the starting point is a data structure issued from package **forestables**.

The first section, **A**, shows how to create the spatial inputs from forest inventory data in tree lists, which will be the general case. The second section, **B**, shows the differences that occur when the starting point is a data structure issued from package **forestables**. For that part we need package **forestables** in our environment, because we will take an example data table from there. The package can be installed from GitHub:
```{r}
# remotes::install_github("emf-creaf/forestables")
library(forestables)
```

## A. General procedure

Expand Down Expand Up @@ -289,7 +293,7 @@ Here we will use only data from the last survey (IFN4):

```{r}
ifn4_example <- ifn_output_example |>
filter(version == "ifn4")
dplyr::filter(version == "ifn4")
ifn4_example
```

Expand Down

0 comments on commit e18edc6

Please sign in to comment.