sensebox / opensensmapR

R client for opensensemap.org
https://noerw.github.io/opensensmapR/inst/doc/osem-history
8 stars 5 forks source link

upcoming sf breaks opensensemapR #31

Open edzer opened 9 months ago

edzer commented 9 months ago

an improvement to sf revealed a coding error in opensensmapR, and breaks the vignette building. If you run osem-intro.Rmd up to line 147, and then do

> st_as_sf(pm25) |> names()
# [1] NA    NA    NA    NA    NA    NA    "NA."

you see that the column names vanished. This now breaks because the geometry column name is set to geometry and passed on to sf_sf() where it needs to be found (but isn't). The error comes from https://github.com/sensebox/opensensmapR/blob/master/R/external_generics.R#L27 where mostattributes<- fails to set names when columns are deselected:

pm25[-c(3,4)] |> head()
# NULL
edzer commented 9 months ago

Let me know if you need help fixing this one.