-
Notifications
You must be signed in to change notification settings - Fork 0
/
report.Rmd
executable file
·163 lines (105 loc) · 6.58 KB
/
report.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
---
always_allow_html: true
---
# FOLIAR NUTRIENT DIAGNOSIS REPORT
* Reporting date/time: `r Sys.time()`
#### *Caution!* Please note that this report was made through the proto-version of *FOLIAR NUTRIENT DIAGNOSIS*, so the diagnosis and fertilizer prescription might contain errors.
## Diagnosis reported for:
* Name: `r paste(input$FirstName, input$LastName)`
* Organization: `r input$Org`
* Address: `r input$Addr_1` `r input$Addr_2` `r input$Addr_3` `r input$Addr_4`
* Foliar sampling date: `r input$samp_date`
* Analytical Laboratory: `r input$Lab_type`
## Site/Stand Information:
* Sample ID: `r input$SampID`
* Species: `r input$spp`
* Site Location: `r input$SiteID`
* BEC Subzone: `r paste(input$BEC_zone, input$BEC_subz)`
* Site series: `r input$BEC_site`
* Elevation (m): `r input$Elev`
* Mapsheet: `r input$Map`
* Opening: `r input$Open`
* Stand age (yrs): `r input$Age`
* Stand origin: `r switch(input$Origin, "Plantation" = "Plantation", "Natural_F"="Natural (fire origin)", "Natural_H"= "Natural (harvest origin)")`
* Site index (m): `r input$SI`
* Percent Live Crown: `r input$Crown`
* Recently (past two years) fertilized (Yes/No): `r input$Prev_fert`
```{r out.width='100%', echo=FALSE, warning=FALSE, message=FALSE}
lng <- ifelse(input$Long_deg=="", -123.3666667, as.numeric(input$Long_deg) + as.numeric(input$Long_min)/60)
lat <- ifelse(input$Lat_deg=="", 48.4166667, as.numeric(input$Lat_deg) + as.numeric(input$Lat_min)/60)
samp_loc <- data.frame(lng = lng, lat = lat)
map_borders <- c(bottom = lat - 0.4,
top = lat + 0.4,
left = lng - 0.6,
right = lng + 0.6)
map <- get_stamenmap(map_borders, maptype = "toner-lite")
ggmap(map) +
geom_point(data=samp_loc, mapping = aes(x = lng, y = lat, col = "red", size = 200, alpha = 1),
show.legend = FALSE) + xlab("Longitude") + ylab("Latitude") + ggtitle('Sample Location') +
theme(panel.border = element_rect(colour = "black", fill=NA, size=1.3))
```
## Foliar Sampling Information:
* Crown position: `r input$Cr_pos`
* Foliar age: `r switch(input$Leaf_age, "Cur_yr" = "Current year", "1_yr"="1-year-old", "1-yr-more"= "Greater than 1-year-old", "Mixed ages" = "Mixed ages")`
* Individual/composite Sample: `r ifelse(input$Diag_base=="Indv_sam", "Individual sample" ,"Composite sample")`
`r if(input$Diag_base=="Comp_sam") paste("* Number of trees per composite: ", input$Comp_Number )`
* Pertinent site/stand information: `r input$Pertinent`
## Foliar Nutrient Data:
```{r, tableMultiline, echo=FALSE,warning=FALSE}
suppressWarnings(suppressMessages(library("pander"))) # suppress warnings
panderOptions('table.continues', '')
outtb <- output.table()
rownames(outtb) <- NULL
colnames (outtb) <- c("Elements", "Measured Values", "Normalized Values", "Deviation from Adequate Level", "Interpretation", "Desirable Condition")
pander(outtb, split.table = Inf, round=1, style = 'rmarkdown')
```
## COMMENTS:
```{r, echo=FALSE,warning=FALSE}
write_super_comment(spp = input$spp, Lab_type = input$Lab_type, Crown = input$Crown,
B_value = B_norm(), N_K_value = N_norm()/K_norm(),
Cr_pos = input$Cr_pos, samp_date = input$samp_date,
Diag_base = input$Diag_base,
Comp_Number = as.numeric(input$Comp_Number),
Leaf_age = input$Leaf_age, Pertinent = input$Pertinent)
```
## DIAGNOSIS:
*see "Comments" above for factors that may affect the foliar nutrient diagnosis*
### Nitrogen (N):
`r concat_comments_nutrients(spp = input$spp, "N", N_norm(), input$Prev_fert, input$Lab_type)`
### Phosphorus (P):
`r concat_comments_nutrients(spp = input$spp, "P", P_norm(), input$Prev_fert, input$Lab_type)`
`r concat_comments_nutrients_ratio(spp = input$spp, "N:P", N_norm()/P_norm(), P_norm(), SO4_norm(), input$Prev_fert)`
### Potassium (K):
`r concat_comments_nutrients(spp = input$spp, "K", K_norm(), input$Prev_fert, input$Lab_type)`
`r concat_comments_nutrients_ratio(spp = input$spp, "N:K", N_norm()/K_norm(), K_norm(), SO4_norm(), input$Prev_fert)`
### Calcium (Ca):
`r concat_comments_nutrients(spp = input$spp, "Ca", Ca_norm(), input$Prev_fert, input$Lab_type)`
### Magnesium (Mg):
`r concat_comments_nutrients(spp = input$spp, "Mg", Mg_norm(), input$Prev_fert, input$Lab_type)`
`r concat_comments_nutrients_ratio(spp = input$spp, "N:Mg", N_norm()/Mg_norm(), Mg_norm(), SO4_norm(), input$Prev_fert)`
### Sulphur (S):
`r concat_comments_nutrients(spp = input$spp, "S", S_norm(), input$Prev_fert, input$Lab_type)`
`r concat_comments_nutrients_ratio(spp = input$spp, "N:S", N_norm()/S_norm(), S_norm(), SO4_norm(), input$Prev_fert)`
`r output$diag_SO4 <- renderText(concat_comments_nutrients(spp = input$spp, "SO4", SO4_norm(), input$Prev_fert, input$Lab_type))`
### Copper (Cu):
`r concat_comments_nutrients(spp = input$spp, "Cu", Cu_norm(), input$Prev_fert, input$Lab_type)`
### Zinc (Zn):
`r concat_comments_nutrients(spp = input$spp, "Zn", Zn_norm(), input$Prev_fert, input$Lab_type)`
### Iron (Fe):
`r concat_comments_nutrients(spp = input$spp, "Fe", Fe_norm(), input$Prev_fert, input$Lab_type)`
### Manganese (Mn):
`r concat_comments_nutrients(spp = input$spp, "Mn", Mn_norm(), input$Prev_fert, input$Lab_type)`
### Boron (B):
`r concat_comments_nutrients(spp = input$spp, "B", B_norm(), input$Prev_fert, input$Lab_type)`
## FERTILIZER PRESCRIPTION:
```{r, echo=FALSE,warning=FALSE}
write_super_prescription (spp = input$spp, Prev_fert = input$Prev_fert, N_value = N_norm(),
Lab_type = input$Lab_type, SO4_value = SO4_norm(),
N_S_value = N_norm()/S_norm(), Cu_value = Cu_norm(),
Zn_value = Zn_norm(), Fe_value = Fe_norm(),
Mn_value = Mn_norm(), P_value = P_norm(),
N_P_value = N_norm()/P_norm(), K_value = K_norm(),
N_K_value = N_norm()/K_norm(), Ca_value = Ca_norm(),
Mg_value = Mg_norm(), N_Mg_value = N_norm()/Mg_norm(),
B_value = B_norm())
```