[R] Errors running spdplyr example

Shige Song shigesong at gmail.com
Wed Jun 7 09:29:16 CEST 2017


Dear All,

When I tried to run the following code (taken from the *spdplyr* package
vignettes):

library(spdplyr)
library(maptools)
data(wrld_simpl)

worldcorner <- wrld_simpl %>%
  mutate(lon = coordinates(wrld_simpl)[,1], lat =
coordinates(wrld_simpl)[,2]) %>%
  filter(lat < -20, lon > 60) %>%
  dplyr::select(NAME)


I got the following error messages:

Error in (function (cl, name, valueClass)  :
  c("assignment of an object of class “tbl_df” is not valid for @‘data’ in
an object of class “SpatialPolygonsDataFrame”; is(value, \"data.frame\") is
not TRUE", "assignment of an object of class “tbl” is not valid for @‘data’
in an object of class “SpatialPolygonsDataFrame”; is(value, \"data.frame\")
is not TRUE", "assignment of an object of class “data.frame” is not valid
for @‘data’ in an object of class “SpatialPolygonsDataFrame”; is(value,
\"data.frame\") is not TRUE")

I am running R 3.3.3 with the latest CRAN version of *spdplyr* (0.1.3) on
Windows 10.

Thanks.

Best,
Shige

	[[alternative HTML version deleted]]



More information about the R-help mailing list