inbo / n2khab

R package with preprocessing functions and standard reference data for Flemish Natura 2000 (N2K) habitat (HAB) analyses
https://inbo.github.io/n2khab
GNU General Public License v3.0
2 stars 1 forks source link

Always use read_sf() in packaged functions * #27

Closed florisvdh closed 5 years ago

florisvdh commented 5 years ago

This avoids the necessary use of quiet = TRUE, stringsAsFactors = FALSE, as_tibble = TRUE with st_read().

This was especially needed as it appeared that the patches element of read_habitatmap_stdized() and read_watersurfaces_hab() had all NA's in the polygon_id column when using options(stringsAsFactors = FALSE) in an R script. That's because the stringsAsFactors argument of previously used st_read() was not set, and it then takes the environment's setting. Consequence: the polygon_id of the polygons element was not automatically set as a factor, resulting in its levels being NULL .

read_sf() applies quiet = TRUE, stringsAsFactors = FALSE, as_tibble = TRUE by default.

ToonHub commented 5 years ago

OK!