I am on this site from some days for a work in R I am doing (on R-Studio), but I could not find the answer to my problem yet (it's the 3rd day I use R). The error is what follows:
Error in readOGR(getwd(), "myfile") : could not find function "readOGR"
I am following a tutorial that should guide me through this work, and it gives me all the installation packages I need. I already installed what follows (directly from my console):
install.packages(c("rgdal","rgeos","BAMMtools","RColorBrewer"))
Once installed, I wrote:
i=read.csv("myfile.csv", header=TRUE, sep=";")
and it worked perfectly, but when I got to
c=readOGR(getwd(),"myotherfile")
it didn't work, and I tried really hard!
I already tried the following codes trying to load the data:
readOGR(dsn=path.expand("~/way/to/my/file/myfile"),layer="myfile")
(my data is all saved in the same working directory file), I tried:
library(raster)
c = shapefile("~/way/to/my/file/my file.shp")
And it didn't work... At this point (as I do absolutely know nothing in R) I do really have to look for help elsewhere!
Anyways the tutorial should really already give me all info and data, but I can't understand why this one thing doesn't work...
MrFlick i THINK YOU INTENDED THIS:
As someone made me see a similar question was already asked, the answer to that question was what follows, BUT:
Did you write the name of your function correctly? Names are case sensitive. YES Did you install the package that contains the function? install.packages("thePackage") (this only needs to be done once) YES Did you attach that package to the workspace ? require(thePackage) or library(thePackage) (this should be done every time you start a new R session) YES
I will appreciate any try to help :) thank you very much!
Bruno