File size: 902 Bytes
8fe5327
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
box::use(highcharter[highchart,
                     hcaes,
                     hc_title,
                     hc_xAxis,
                     hc_yAxis,
                     hc_tooltip])

box::use(dplyr[filter])

#* @param df data frame containing the data 
#* @param vernacular the vernacular names of the animals
plotData <- function(df,vernacular,locality) {
  
  df |> 
    filter(vernacularName == vernacular,locality == locality) |> 
    hchart(
      type = "scatter",
      hcaes(x = eventDate,
            y = individualCount)) |> 
    hc_title(text = "Biodiversity in Poland") |> 
    hc_xAxis(title = list(text = "Event Date")) |> 
    hc_yAxis(title = list(text = "Individual Count")) |> 
    hc_tooltip(
      pointFormat = 'Date: {point.x:%Y-%m-%d}<br>Individual Count: {point.y:.2f}'
    )
  
}

# plotData(bio_pol,
#          vernacular = "Mandarin Duck")