Skip to content

Commit f31c2e5

Browse files
committed
usage examples [WIP]
1 parent 9500ab3 commit f31c2e5

7 files changed

Lines changed: 29 additions & 32 deletions

README.Rmd

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ knitr::opts_chunk$set(
99
collapse = TRUE,
1010
comment = "#>",
1111
fig.path = "man/figures/README-",
12-
fig.width = 6.2, fig.height = 6.2
12+
fig.width = 7, fig.height = 7,
13+
out.width = "70%"
1314
)
1415
```
1516

@@ -51,11 +52,11 @@ The data frame `cw_coef` provides a curated set of linear regression coefficient
5152
```{r predict-crwidth}
5253
library(FIAstemmap)
5354
54-
# structure of the cw_coef dataset
55-
str(cw_coef)
55+
# regression coefficients for estimating tree crown width from diameter
56+
head(cw_coef)
5657
57-
# add a column of predicted crown width to the plantation tree list
58-
# `within()` is used to modify only a copy of the example dataset
58+
# add predicted crown widths to the plantation tree list
59+
# `within()` to modify only a copy of the example dataset
5960
tree_list <- within(plantation, CRWIDTH <- calc_crwidth(plantation))
6061
str(tree_list)
6162
```
@@ -65,8 +66,7 @@ str(tree_list)
6566
Plot-level visualization and other exploratory analyses require input data with stem locations provided in columns `AZIMUTH` (horizontal angle from subplot/microplot center to the stem location, in range `0:359`) and `DIST` (stem distance from subplot/microplot center).
6667

6768
```{r plot-crowns}
68-
# display modeled tree crowns projected vertically on boundaries of the FIA
69-
# four-subplot cluster design
69+
# display modeled tree crowns projected vertically on the FIA plot boundary
7070
plot_crowns(tree_list, main = "plantation plot")
7171
7272
# individual subplot
@@ -89,8 +89,8 @@ plot(X, pch = 16, main = "Loblolly pine plantation")
8989
# compute Ripley's K-function applying isotropic edge correction
9090
K <- spatstat.explore::Kest(X, rmax = 12, correction = "isotropic")
9191
92-
# plot estimated values of K(r) along with theoretical values for a completely
93-
# random (Poisson) point process, suggestng spatial regularity in this case
92+
# plot estimated K(r) along with theoretical values for a random (Poisson)
93+
# point process, suggests spatial regularity in this case
9494
plot(K, main = "Ripley's K for the plantation trees")
9595
```
9696

README.md

Lines changed: 20 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -73,20 +73,18 @@ using the `plantation` example tree list.
7373
``` r
7474
library(FIAstemmap)
7575

76-
# structure of the cw_coef dataset
77-
str(cw_coef)
78-
#> 'data.frame': 430 obs. of 8 variables:
79-
#> $ symbol : chr "ABAM" "ABCO" "ABGR" "ABLAA" ...
80-
#> $ SPCD : num 11 15 17 18 19 20 21 22 41 62 ...
81-
#> $ common_name: chr "Pacific silver fir" "white fir" "grand fir" "corkbark fir" ...
82-
#> $ surrogate : chr NA NA NA NA ...
83-
#> $ b0 : num 7.3 4.49 5.75 6.07 3.96 6.67 6.67 6.32 2.36 -2.12 ...
84-
#> $ b1 : num 0.59 0.92 1.11 0.37 0.64 0.43 0.43 0.65 0.99 1.73 ...
85-
#> $ b2 : num 0 -0.01 -0.01 0 0 0 0 0 0 -0.02 ...
86-
#> $ reference : chr "Bechtold (2004)" "Bechtold (2004)" "Bechtold (2004)" "Bechtold (2004)" ...
87-
88-
# add a column of predicted crown width to the plantation tree list
89-
# `within()` is used to modify only a copy of the example dataset
76+
# regression coefficients for estimating tree crown width from diameter
77+
head(cw_coef)
78+
#> symbol SPCD common_name surrogate b0 b1 b2 reference
79+
#> 1 ABAM 11 Pacific silver fir <NA> 7.30 0.59 0.00 Bechtold (2004)
80+
#> 2 ABCO 15 white fir <NA> 4.49 0.92 -0.01 Bechtold (2004)
81+
#> 3 ABGR 17 grand fir <NA> 5.75 1.11 -0.01 Bechtold (2004)
82+
#> 4 ABLAA 18 corkbark fir <NA> 6.07 0.37 0.00 Bechtold (2004)
83+
#> 5 ABLA 19 subalpine fir <NA> 3.96 0.64 0.00 Bechtold (2004)
84+
#> 6 ABMA 20 California red fir <NA> 6.67 0.43 0.00 Gill et al. (2000)
85+
86+
# add predicted crown widths to the plantation tree list
87+
# `within()` to modify only a copy of the example dataset
9088
tree_list <- within(plantation, CRWIDTH <- calc_crwidth(plantation))
9189
str(tree_list)
9290
#> 'data.frame': 91 obs. of 13 variables:
@@ -113,20 +111,19 @@ from subplot/microplot center to the stem location, in range `0:359`)
113111
and `DIST` (stem distance from subplot/microplot center).
114112

115113
``` r
116-
# display modeled tree crowns projected vertically on boundaries of the FIA
117-
# four-subplot cluster design
114+
# display modeled tree crowns projected vertically on the FIA plot boundary
118115
plot_crowns(tree_list, main = "plantation plot")
119116
```
120117

121-
![](man/figures/README-plot-crowns-1.png)<!-- -->
118+
<img src="man/figures/README-plot-crowns-1.png" alt="" width="70%" />
122119

123120
``` r
124121

125122
# individual subplot
126123
plot_crowns(tree_list, subplot = 4, main = "plantation subplot 4")
127124
```
128125

129-
![](man/figures/README-plot-crowns-2.png)<!-- -->
126+
<img src="man/figures/README-plot-crowns-2.png" alt="" width="70%" />
130127

131128
``` r
132129

@@ -135,7 +132,7 @@ plot_crowns(tree_list, subplot = 4, microplot = TRUE,
135132
main = "plantation microplot 4")
136133
```
137134

138-
![](man/figures/README-plot-crowns-3.png)<!-- -->
135+
<img src="man/figures/README-plot-crowns-3.png" alt="" width="70%" />
139136

140137
Helper functions are provided to facilitate analyzing FIA tree lists as
141138
Spatial Point Patterns using the **spatstat** library.
@@ -170,19 +167,19 @@ summary(X)
170167
plot(X, pch = 16, main = "Loblolly pine plantation")
171168
```
172169

173-
![](man/figures/README-spatstat-explore-1.png)<!-- -->
170+
<img src="man/figures/README-spatstat-explore-1.png" alt="" width="70%" />
174171

175172
``` r
176173

177174
# compute Ripley's K-function applying isotropic edge correction
178175
K <- spatstat.explore::Kest(X, rmax = 12, correction = "isotropic")
179176

180-
# plot estimated values of K(r) along with theoretical values for a completely
181-
# random (Poisson) point process, suggestng spatial regularity in this case
177+
# plot estimated K(r) along with theoretical values for a random (Poisson)
178+
# point process, suggests spatial regularity in this case
182179
plot(K, main = "Ripley's K for the plantation trees")
183180
```
184181

185-
![](man/figures/README-spatstat-explore-2.png)<!-- -->
182+
<img src="man/figures/README-spatstat-explore-2.png" alt="" width="70%" />
186183

187184
### Compute stand structure metrics
188185

3.18 KB
Loading
3.29 KB
Loading
2.68 KB
Loading
2.51 KB
Loading
2.04 KB
Loading

0 commit comments

Comments
 (0)