2

I'm trying to create SpatialPoints objetcs from data frame on R

natFPV <- SpatialPointsDataFrame(coords = coordinates(natFPv.per_data[,c(27,28)]),data = natFPv.per_data[,-c(27,28)])
natFPV <- SpatialPoints(coords = coordinates(natFPv.per_data[,c(27,28)]))

But getting the error for both:

Warning: Error in SpatialPoints: could not find function "SpatialPoints"

I'm really don't konw how to deal it.

Kazuhito
31.4k6 gold badges78 silver badges157 bronze badges
asked Oct 18, 2017 at 11:11
1
  • Have you imported the library with library(sp)? Commented Oct 18, 2017 at 11:23

1 Answer 1

2

You need to load the library with:

library(sp)

You need to do this once in each session, unless you customize your environment to automatically load it each time

answered Oct 18, 2017 at 12:00

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.