Client: Coral Restoration Foundation https://www.coralrestoration.org/
Contacts:
Alice Granger: Communications Director
Alex Neufeld: Data Manager
library(leaflet)
library(ggplot2)
library(readxl)
library(readxl)
Sample_Data <- read_excel("Sample_Data.xlsx")
Leaflet is a popular open source Javascript tool used to create interactive mapping. Large websites such as The New York Times, The Washington Post, Flikr, and many others use leaflet to integrate maps.
We want to use this as a way to disaply the regions for visitors of the website that the CRF is doing work in
# Calling standard Leaflet map.
m <- leaflet() %>%
addTiles() %>%
addMarkers(lng=-80.16083, lat=24.98475)
m
# Adding "popups" to our points to bring up information
m <- leaflet() %>%
addTiles() %>%
addMarkers(lng=-80.16083, lat=24.98475, popup="Pickles Reef")%>%
addMarkers(lng=-81.7435, lat=24.473867, popup="Marker 32") %>%
addMarkers(lng=-080.4363000, lat=24.9822000, popup="CRF Nursery"
)
m
HTML can be used to create the format for pop ups
# using paste() to create an HTML layout for more detailed popups
library(htmltools)
pop1 <- paste(sep = "<br/>",
"<b><a>Pickles Reef </a></b>",
"Lattitude: 24.98475",
"Longitude: -80.16083",
"Specimans planted: A. cervicornis "
)
pop2 <- paste(sep = "<br/>",
"<b><a>Marker 32 </a></b>",
"Lattitude: 24.473867",
"Longitude: -81.7435",
"Specimans planted: A. cervicornis "
)
pop3 <- paste(sep = "<br/>",
"<b><a>CRF Nursery </a></b>",
"Lattitude: 24.9822000",
"Longitude: -080.4363000",
"Speciman Collection Date: Circa 1996"
)
pop4 <- paste(sep = "<br/>",
"<b><a> Plantation Key Patch Reef </a></b>",
"Lattitude: 24.9518833°",
"Longitude: -080.4363000",
"Speciman Collection Date: Circa 1996"
)
m <- leaflet() %>%
addTiles() %>%
addMarkers(lng=-80.16083, lat=24.98475, popup=pop1,)%>%
addMarkers(lng=-81.7435, lat=24.473867, popup=pop2)%>%
addMarkers(lng=-080.4363000,lat=24.9822000,popup=pop3)%>%
addMarkers(lng=-080.4916167, lat= 24.9518833, popup=pop4)
m
Creating basic bar graph from the data in the maps.
There were 21 of each genotype planted in the various locations. This graphic shows how many of the corals planted remain.
mydata = Sample_Data
reefplot <- ggplot(data = mydata, aes(Genotype, NumAliveYear, fill = Species)) +
geom_bar(stat="identity")
reefplot
Code for our ineteractive web application
https://russell-chebahtah.shinyapps.io/SeniorProject/
#library(shiny)
#library(rsconnect)
#library(ggplot2)
#
#
#ui <- fluidPage(
# sliderInput(inputId = "alpha",
# label = "Choose A Value Of Alpha",
# value = .5, min = 0, max = 1),
#
# sliderInput(inputId = "size",
# label = "Choose A Dot Size",
# value = 2.5, min = 0, max = 5),
#
# selectInput(inputId='x', label = h3('X-Axis'),
# choices = c(
# "Genotype"
# "NumPlanted"
# ),
# selected = "Genotype"
#
# ),
# selectInput(inputId='y', label = h3('Y-Axis'),
# choices = c(
# "NumPlanted",
# "NumAliveMonth",
# "NumAliveYear"),
# selected = "NumPlanted"
#
# ),
#
#
#
# plotOutput("scatter")
#)
#
#server <- function(input, output) {
#
# output$scatter <- renderPlot({
# ggplot(data = Sample_Data,aes_string(input$x,input$y, color = "Species")) +
# geom_point(alpha = input$alpha,
# size=input$size)
# })
#
#