Skip to contents

This function prepares data for Leaflet JavaScript visualization.

Usage

prepare_leaflet(dbchene, dbtruffe, dbreens)

Arguments

dbchene

A data frame containing information about oak trees.

dbtruffe

A data frame containing information about truffles.

dbreens

A data frame containing information about reensemencement.

Value

A list suitable for passing to Leaflet JavaScript for visualization.

Examples

dbchene <- data.frame(
  idoak = c(1, 2, 3),
  chene_nom = c("Chene 1", "Chene 2", "Chene 3")
)

dbreens <- data.frame(
  idreens = c(8),
  idoak = c(2),
  date_reens = c("2022-04-30")
)

dbtruffe <- data.frame(
  idoak = c(1, 1, 3),
  idtruffle = c(1, 2, 3),
  estimation = c(1, 0, 1),
  weight = c(10, 15, NA)
)
prepare_leaflet(dbchene, dbtruffe, dbreens)
#> $data_prep
#> $data_prep[[1]]
#> $data_prep[[1]][[1]]
#> [1] "1"
#> 
#> $data_prep[[1]][[2]]
#> [1] "Chene 1"
#> 
#> $data_prep[[1]][[3]]
#> [1] "1"
#> 
#> $data_prep[[1]][[4]]
#> [1] "NA"
#> 
#> 
#> $data_prep[[2]]
#> $data_prep[[2]][[1]]
#> [1] "2"
#> 
#> $data_prep[[2]][[2]]
#> [1] "Chene 2"
#> 
#> $data_prep[[2]][[3]]
#> [1] "NA"
#> 
#> $data_prep[[2]][[4]]
#> [1] "1"
#> 
#> 
#> $data_prep[[3]]
#> $data_prep[[3]][[1]]
#> [1] "3"
#> 
#> $data_prep[[3]][[2]]
#> [1] "Chene 3"
#> 
#> $data_prep[[3]][[3]]
#> [1] "1"
#> 
#> $data_prep[[3]][[4]]
#> [1] "NA"
#> 
#> 
#> 
#> $names_element
#> [1] "idoak"        "chene_nom"    "info_missing" "info_reens"  
#>