@@ -12,6 +12,7 @@ knitr::opts_chunk$set(
12
12
library(magrittr)
13
13
library(modisfast)
14
14
library(dplyr)
15
+ library(kableExtra)
15
16
```
16
17
# modisfast
17
18
<!-- <img src="man/figures/logo.png" align="right" /> -->
@@ -175,13 +176,13 @@ Currently `modisfast` supports download of `r nrow(mf_list_collections())` data
175
176
176
177
Details of each product available for download are provided in the tables below or through the function ` mf_list_collections() ` .
177
178
178
- <details ><summary ><b >MODIS and VIIRS data collections accessible with modisfast (click to expand)</b ></summary >
179
- <p >
180
179
181
180
``` {r, eval = TRUE, echo=F,message=F}
182
- library(kableExtra)
183
- mf_list_collections() %>%
184
- dplyr::filter(source %in% c("MODIS", "VIIRS")) %>%
181
+
182
+ fun_display_coll <- function(filts){
183
+
184
+ cols <- mf_list_collections() %>%
185
+ dplyr::filter(nature %in% filts) %>%
185
186
dplyr::mutate(collection = cell_spec(collection, "html", link = doi)) %>%
186
187
dplyr::mutate(spatial_resolution_m = paste0(spatial_resolution_m, " m")) %>%
187
188
dplyr::mutate(temporal_resolution = paste0(temporal_resolution," ",temporal_resolution_unit)) %>%
@@ -192,32 +193,29 @@ mf_list_collections() %>%
192
193
dplyr::rename(Collection = collection, Type = nature, Name = long_name, Source = source, 'Spatial resolution' = spatial_resolution_m, 'Temporal resolution' = temporal_resolution, 'Temporal extent' = start_date) %>%
193
194
kable("html", escape = FALSE) %>%
194
195
kable_styling(bootstrap_options = c("hover", "condensed"))
196
+
197
+ return(cols)
198
+
199
+ }
200
+
201
+ cols_natures <- unique(mf_list_collections()$nature)
202
+
195
203
```
196
204
197
- </p >
198
- </details >
199
205
200
- <details ><summary ><b >Other (non-MODIS or VIIRS) data collections accessible with modisfast (click to expand)</b ></summary >
201
- <p >
206
+ ``` {r, eval = TRUE, echo=F, message=F, results='asis'}
207
+ for(i in 1:length(cols_natures)){
208
+ if(i==1){
209
+ cat('<details><summary><b>',cols_natures[i],'</b> data collections <b>(click to expand)</b></summary>')
210
+ } else {
211
+ cat('<details><summary><b>',cols_natures[i],'</b> data collections</summary>')
212
+ }
213
+ cat(knitr::asis_output(fun_display_coll(cols_natures[i])))
214
+ cat('</details>')
215
+ }
202
216
203
- ``` {r, eval = TRUE, echo=F,message=F}
204
- library(kableExtra)
205
- mf_list_collections() %>%
206
- dplyr::filter(!(source %in% c("MODIS", "VIIRS"))) %>%
207
- dplyr::mutate(collection = cell_spec(collection, "html", link = doi)) %>%
208
- dplyr::mutate(spatial_resolution_m = paste0(spatial_resolution_m, " m")) %>%
209
- dplyr::mutate(temporal_resolution = paste0(temporal_resolution," ",temporal_resolution_unit)) %>%
210
- dplyr::mutate(temporal_resolution = ifelse(temporal_resolution=="1 day", "Daily", temporal_resolution)) %>%
211
- dplyr::mutate(start_date = paste0(start_date," to present")) %>%
212
- dplyr::select(collection, source, nature, long_name, spatial_resolution_m, temporal_resolution, start_date) %>%
213
- dplyr::arrange(nature, source, spatial_resolution_m, rev(temporal_resolution)) %>%
214
- dplyr::rename(Collection = collection, Type = nature, Name = long_name, Source = source, 'Spatial resolution' = spatial_resolution_m, 'Temporal resolution' = temporal_resolution, 'Temporal extent' = start_date) %>%
215
- kable("html", escape = FALSE) %>%
216
- kable_styling(bootstrap_options = c("hover", "condensed"))
217
217
```
218
218
219
- </p >
220
- </details >
221
219
222
220
## Manual testing of the functionality
223
221
0 commit comments