Incorrect parsing of apostrophes (`'`) when using `%in%`
daxkellie opened this issue · 1 comments
daxkellie commented
Found by @fontikar, galah_filter()
doesn't correctly parse apostrophes when using %in%
library(galah)
names <- c("Australia's Virtual Herbarium",
"iNaturalist observations",
"iNaturalist research-grade observations")
# doesn't work
galah_call() |>
filter(datasetName %in% names) |>
atlas_counts()
#> Error in parse(text = x, keep.source = FALSE): <text>:1:27: unexpected symbol
#> 1: datasetName == 'Australia's
#> ^
# works
galah_call() |>
galah_filter(datasetName == "Australia's Virtual Herbarium") |>
atlas_counts()
#> # A tibble: 1 × 1
#> count
#> <int>
#> 1 269620
Created on 2023-11-28 with reprex v2.0.2
The current solution is to use escaping with \\
names <- c("Australia\\'s Virtual Herbarium", # fixed
"iNaturalist observations",
"iNaturalist research-grade observations")
# works
galah_call() |>
filter(datasetName %in% names) |>
atlas_counts()
#> # A tibble: 1 × 1
#> count
#> <int>
#> 1 6025188
Created on 2023-11-28 with reprex v2.0.2