This presentation shows myApp, and application created using R and Shiny.
The apps shows Brazilian forest loss due to several factors from 2001 to 2013. All the supporting documentations can be seen in:
4/9/2021
This presentation shows myApp, and application created using R and Shiny.
The apps shows Brazilian forest loss due to several factors from 2001 to 2013. All the supporting documentations can be seen in:
The data used in this app is part of TidyTuesday community, avalilable on link. The dataset shows loss of Brazilian forest due to specific types from 2001 to 2013.
br <- read.csv('https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2021/2021-04-06/brazil_loss.csv')
The selection of the variable and date range is made by reactivity (see code).
For example, selecting Commercial crops and a range from 2001-2006 display the following results.
range <- c(2001, 2006) # In the app = input$range var <- "commercial_crops" # In the app = input$var
The results calculated are a numeric value and a graph.
The results are calculated as:
x <- br %>% select(year, var) x <- x[x$year %in% seq(from = min(range), to = max(range), by = 1), ] sum(x[,2])
## [1] 2508000
g <- x %>% ggplot(aes(.[[1]],.[[2]])) +
geom_point(size=3, color="#69b3a2") +
geom_area(fill="#69b3a2", alpha=0.4) +
geom_line(color="#69b3a2", size=2) +
labs(x="Time period", y = "Forest loss (in Ha)") +
theme(axis.text=element_text(size=12), axis.title=element_text(size=14)) +
ggtitle("Loss by period")
print(g)