Skip to contents

The Brooklyn Botanic Garden image of the cherry blossoms have their (relative) positions embedded within the HTML and JavaScript of the webpage. This vignette explores how to pull those positions out and check them against the existing data.

library(bbggplots)
library(dplyr)
#> 
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#> 
#>     filter, lag
#> The following objects are masked from 'package:base':
#> 
#>     intersect, setdiff, setequal, union
library(stringr)

All trees should have positions

bbgdata |>
  distinct(alt, tree, id) |>
  mutate(id_full = str_c(tree, id, sep = "_")) |>
  full_join(treepositions, by = c("id_full", "tree", "id", "alt")) |>
  filter(if_any(everything(), is.na)) |>
  arrange(tree, id)
#> # A tibble: 61 × 9
#>    alt                         tree  id    id_full style   top  left     x     y
#>    <chr>                       <chr> <chr> <chr>   <chr> <dbl> <dbl> <dbl> <dbl>
#>  1 Prunus 'Accolade'           acco… 151   accola… NA     NA    NA      NA    NA
#>  2 Prunus 'Accolade'           acco… 152   accola… NA     NA    NA      NA    NA
#>  3 Prunus 'Accolade'           acco… 79    accola… NA     NA    NA      NA    NA
#>  4 Prunus × yedoensis ‘Akebon… akeb… 105   akebon… NA     NA    NA      NA    NA
#>  5 Prunus ‘Ariake’             aria… 154   ariake… NA     NA    NA      NA    NA
#>  6 Prunus ‘Fudan-zakura’       fuda… 107   fudan_… NA     NA    NA      NA    NA
#>  7 Prunus ‘Fudan-zakura’       fuda… 124   fudan_… NA     NA    NA      NA    NA
#>  8 Prunus ‘Hata-zakura’        hata… 106   hataza… NA     NA    NA      NA    NA
#>  9 Prunus × subhirtella ‘Juga… juga… 109   jugats… NA     NA    NA      NA    NA
#> 10 Prunus ‘Kanzan’             kanz… 41    kanzan… posi…  32.9  21.1    NA    NA
#> # ℹ 51 more rows

As of 2026-05-05, we can see there is some work to be done and to figure out where these 70+ trees’ information are.

Session info

sessionInfo()
#> R version 4.6.0 (2026-04-24)
#> Platform: x86_64-pc-linux-gnu
#> Running under: Ubuntu 24.04.4 LTS
#> 
#> Matrix products: default
#> BLAS:   /usr/lib/x86_64-linux-gnu/openblas-pthread/libblas.so.3 
#> LAPACK: /usr/lib/x86_64-linux-gnu/openblas-pthread/libopenblasp-r0.3.26.so;  LAPACK version 3.12.0
#> 
#> locale:
#>  [1] LC_CTYPE=C.UTF-8       LC_NUMERIC=C           LC_TIME=C.UTF-8       
#>  [4] LC_COLLATE=C.UTF-8     LC_MONETARY=C.UTF-8    LC_MESSAGES=C.UTF-8   
#>  [7] LC_PAPER=C.UTF-8       LC_NAME=C              LC_ADDRESS=C          
#> [10] LC_TELEPHONE=C         LC_MEASUREMENT=C.UTF-8 LC_IDENTIFICATION=C   
#> 
#> time zone: UTC
#> tzcode source: system (glibc)
#> 
#> attached base packages:
#> [1] stats     graphics  grDevices utils     datasets  methods   base     
#> 
#> other attached packages:
#> [1] stringr_1.6.0        dplyr_1.2.1          bbggplots_0.0.0.9000
#> 
#> loaded via a namespace (and not attached):
#>  [1] vctrs_0.7.3        cli_3.6.6          knitr_1.51         rlang_1.2.0       
#>  [5] xfun_0.57          stringi_1.8.7      generics_0.1.4     S7_0.2.2          
#>  [9] textshaping_1.0.5  jsonlite_2.0.0     glue_1.8.1         htmltools_0.5.9   
#> [13] ragg_1.5.2         sass_0.4.10        scales_1.4.0       rmarkdown_2.31    
#> [17] grid_4.6.0         tibble_3.3.1       evaluate_1.0.5     jquerylib_0.1.4   
#> [21] fastmap_1.2.0      yaml_2.3.12        lifecycle_1.0.5    compiler_4.6.0    
#> [25] RColorBrewer_1.1-3 fs_2.1.0           pkgconfig_2.0.3    farver_2.1.2      
#> [29] systemfonts_1.3.2  digest_0.6.39      R6_2.6.1           utf8_1.2.6        
#> [33] tidyselect_1.2.1   pillar_1.11.1      magrittr_2.0.5     bslib_0.10.0      
#> [37] withr_3.0.2        tools_4.6.0        gtable_0.3.6       pkgdown_2.2.0     
#> [41] ggplot2_4.0.3      cachem_1.1.0       desc_1.4.3