-
Notifications
You must be signed in to change notification settings - Fork 506
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
addLegend and NA work but only with a workaround #485
Comments
Can you provide a reproducible example that's giving you that error? The tutorial examples work for me (other than the fact that the data has moved to https://github.com/datasets/geo-boundaries-world-110m/raw/master/countries.geojson, which I hadn't noticed). Thanks. |
Let me also note that this error basically means, "you used the formula syntax which implies you gave us some data--but I didn't find any data". I suspect the fact that you're seeing this with |
SOLUTION: don't use leaflet() %>% otherStuff() always provide it with the data (as intended), e.g. leaflet(my_data) %>% otherStuff() |
had that problem when using fillColor, and the way I solved it was using pal(...) instead of ~pal(...), not sure why though |
Providing
addLegend
with values in the fashionvalues = df$variable
rather thanvalues =~variable
solves an occurrence of the error:which happens if
variable
has NA's.I don't see why isn't this the default behaviour.
source:
https://stackoverflow.com/a/32011289/3494126
p.s. for instance, just following this official tutorial with my data I produced the abovementioned error.
Ok, @jcheng5 thanks for the explanation, now I can produce a working/non-working example:
Indeed, the mistake here is using
leaflet() %>%
instead ofleaflet(random_event) %>%
which then works with both versions.I still thing this is a minor bug. But feel free to disregard it. I will try to improve the SO issue, so that anyone who does the same in the future understands why it is not a bug. Although, with your explanation it is definitely more informative.
The text was updated successfully, but these errors were encountered: