Last updated: 2021-09-22
Checks: 7 0
Knit directory: fire_alcontar/
This reproducible R Markdown analysis was created with workflowr (version 1.6.2). The Checks tab describes the reproducibility checks that were applied when the results were created. The Past versions tab lists the development history.
Great! Since the R Markdown file has been committed to the Git repository, you know the exact version of the code that produced these results.
Great job! The global environment was empty. Objects defined in the global environment can affect the analysis in your R Markdown file in unknown ways. For reproduciblity it’s best to always run the code in an empty environment.
The command set.seed(20210630)
was run prior to running the code in the R Markdown file. Setting a seed ensures that any results that rely on randomness, e.g. subsampling or permutations, are reproducible.
Great job! Recording the operating system, R version, and package versions is critical for reproducibility.
Nice! There were no cached chunks for this analysis, so you can be confident that you successfully produced the results during this run.
Great job! Using relative paths to the files within your workflowr project makes it easier to run your code on other machines.
Great! You are using Git for version control. Tracking code development and connecting the code version to the results is critical for reproducibility.
The results in this page were generated with repository version 2c29bd7. See the Past versions tab to see a history of the changes made to the R Markdown and HTML files.
Note that you need to be careful to ensure that all relevant files for the analysis have been committed to Git prior to generating the results (you can use wflow_publish
or wflow_git_commit
). workflowr only checks the R Markdown file, but you know if there are other scripts or data files that it depends on. Below is the status of the Git repository when the results were generated:
Ignored files:
Ignored: .Rhistory
Ignored: .Rproj.user/
Untracked files:
Untracked: data/nbr_autumn.csv
Untracked: data/sentinel_nbr/
Untracked: data/spatial/EP_Andalucía.cpg
Untracked: data/spatial/EP_Andalucía.dbf
Untracked: data/spatial/EP_Andalucía.prj
Untracked: data/spatial/EP_Andalucía.shp
Untracked: data/spatial/EP_Andalucía.shx
Untracked: data/spatial/GEO_PARCELAS.cpg
Untracked: data/spatial/GEO_PARCELAS.dbf
Untracked: data/spatial/GEO_PARCELAS.prj
Untracked: data/spatial/GEO_PARCELAS.qpj
Untracked: data/spatial/GEO_PARCELAS.shp
Untracked: data/spatial/GEO_PARCELAS.shx
Untracked: data/spatial/computed_nbr.tif
Untracked: data/spatial/computed_nbr.tif.aux.xml
Untracked: data/spatial/computed_rbr.tif
Note that any generated files, e.g. HTML, png, CSS, etc., are not included in this status report because it is ok for generated content to have uncommitted changes.
These are the previous versions of the repository in which changes were made to the R Markdown (analysis/fire_severity_drone.Rmd
) and HTML (docs/fire_severity_drone.html
) files. If you’ve configured a remote Git repository (see ?wflow_git_remote
), click on the hyperlinks in the table below to view the files as they were in that past version.
File | Version | Author | Date | Message |
---|---|---|---|---|
Rmd | 2c29bd7 | ajpelu | 2021-09-22 | remove progress bar |
html | f656a44 | Antonio J Perez-Luque | 2021-07-22 | Build site. |
Rmd | 6920c40 | Antonio J Perez-Luque | 2021-07-22 | wflow_publish(c(“analysis/index.Rmd”, “analysis/fire_severity_drone.Rmd”)) |
library(tidyverse)
library(sf)
library(raster)
library(here)
library(DiagrammeR)
library(exactextractr)
library(DT)
library(ggpubr)
dEGI <- raster(here::here("data/fire_severity_img/referenced/dEGI_3colors.tif"))
parcelas <- st_read(dsn = "/Users/ajpelu/Google Drive/my_repos/serpam/ndvi_alcontar/data/spatial/parcelas/GEO_PARCELAS.shp",
quiet = TRUE)
p <- parcelas %>%
filter(stringr::str_detect(NOMBRE, "AL_P_|AL_NP"))
df <- exact_extract(dEGI, p, include_cols = "NOMBRE",
force_df=TRUE, progress = FALSE) %>%
bind_rows() %>%
mutate(fire_sevClass = case_when(
value == 0 ~ "high",
value == 1 ~ "low",
value == 2 ~ "medium"
))
severity <- df %>% group_by(NOMBRE, fire_sevClass) %>% count() %>%
pivot_wider(names_from = fire_sevClass, values_from = n) %>%
rowwise() %>%
mutate(n = sum(high, low, medium)) %>%
mutate(high.pct = high/n*100,
low.pct = low/n*100,
medium.pct = medium/n*100) %>%
mutate(treatment = case_when(
str_detect(NOMBRE, "AL_NP") ~ "NonGrazing",
TRUE ~ "Grazing"
))
severity %>% dplyr::select(NOMBRE,
high.pct, medium.pct, low.pct) %>%
datatable() %>%
formatRound(columns=c("high.pct", "medium.pct", "low.pct"), digits=2)
g <- ggscatter(severity, x="high.pct", y="medium.pct",
color = "treatment",
ellipse = TRUE,
xlab = "% pixels High severity",
ylab = "% pixels Medium severity")
ggpar(g, xlim=c(0,100), ylim = c(0,100))
Version | Author | Date |
---|---|---|
f656a44 | Antonio J Perez-Luque | 2021-07-22 |
At the end, the classification indicates:
sessionInfo()
R version 4.0.2 (2020-06-22)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Catalina 10.15.3
Matrix products: default
BLAS: /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRblas.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRlapack.dylib
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] ggpubr_0.4.0 DT_0.17 exactextractr_0.5.1
[4] DiagrammeR_1.0.6.1 here_1.0.1 raster_3.4-5
[7] sp_1.4-5 sf_1.0-2 forcats_0.5.1
[10] stringr_1.4.0 dplyr_1.0.6 purrr_0.3.4
[13] readr_1.4.0 tidyr_1.1.3 tibble_3.1.2
[16] ggplot2_3.3.5 tidyverse_1.3.1 workflowr_1.6.2
loaded via a namespace (and not attached):
[1] fs_1.5.0 lubridate_1.7.10 RColorBrewer_1.1-2 httr_1.4.2
[5] rprojroot_2.0.2 tools_4.0.2 backports_1.2.1 bslib_0.2.4
[9] rgdal_1.5-23 utf8_1.1.4 R6_2.5.0 KernSmooth_2.23-18
[13] DBI_1.1.1 colorspace_2.0-0 withr_2.4.1 tidyselect_1.1.1
[17] curl_4.3 compiler_4.0.2 git2r_0.28.0 cli_2.5.0
[21] rvest_1.0.0 xml2_1.3.2 labeling_0.4.2 sass_0.3.1
[25] scales_1.1.1 classInt_0.4-3 proxy_0.4-26 digest_0.6.27
[29] foreign_0.8-81 rmarkdown_2.8 rio_0.5.16 pkgconfig_2.0.3
[33] htmltools_0.5.2 highr_0.8 dbplyr_2.1.1 fastmap_1.1.0
[37] htmlwidgets_1.5.3 rlang_0.4.10 readxl_1.3.1 rstudioapi_0.13
[41] farver_2.0.3 visNetwork_2.0.9 jquerylib_0.1.3 generics_0.1.0
[45] jsonlite_1.7.2 crosstalk_1.1.1 zip_2.1.1 car_3.0-10
[49] magrittr_2.0.1 Rcpp_1.0.7 munsell_0.5.0 fansi_0.4.2
[53] abind_1.4-5 lifecycle_1.0.0 stringi_1.7.4 whisker_0.4
[57] yaml_2.2.1 carData_3.0-4 grid_4.0.2 promises_1.2.0.1
[61] crayon_1.4.1 lattice_0.20-41 haven_2.3.1 hms_1.0.0
[65] knitr_1.31 pillar_1.6.1 ggsignif_0.6.0 codetools_0.2-18
[69] reprex_2.0.0 glue_1.4.2 evaluate_0.14 data.table_1.14.0
[73] modelr_0.1.8 vctrs_0.3.8 httpuv_1.5.5 cellranger_1.1.0
[77] gtable_0.3.0 assertthat_0.2.1 openxlsx_4.2.3 xfun_0.23
[81] broom_0.7.9 e1071_1.7-8 rstatix_0.6.0 later_1.1.0.1
[85] class_7.3-18 units_0.7-2 ellipsis_0.3.2