Dear All, I have a script that draws longitude and latitude of lightning occurrence. This script was running fine before. But when I changed my system and do a fresh install on another laptop, this error persist. source("script") Error in eval(expr, envir, enclos) : could not find function "pointsToRaster" I have tried to see if there is any other package I need to install to take of the problem, I could not see. Already, when I installed raster, it installed its dependencies such as sp. Can any body please bail me out. Thanks Ogbos
Leonardo Ferreira Fontenelle
2016-Apr-30 11:20 UTC
[R] Could not find function "pointsToRaster"
Dear Ogbos Okike, I can't know how your script depends on pointsToRaster(), but googling around I found that the function seems to have been marked as obsolete: http://www.inside-r.org/packages/cran/raster/docs/linesToRaste Hope that helps, Leonardo Ferreira Fontenelle http://lattes.cnpq.br/9234772336296638 Em S?b 30 abr. 2016, ?s 05:28, Ogbos Okike escreveu:> Dear All, > I have a script that draws longitude and latitude of lightning > occurrence. This script was running fine before. But when I changed my > system and do a fresh install on another laptop, this error persist. > source("script") > Error in eval(expr, envir, enclos) : > could not find function "pointsToRaster" > > I have tried to see if there is any other package I need to install > to take of the problem, I could not see. Already, when I installed > raster, it installed its dependencies such as sp. > Can any body please bail me out. > > Thanks > Ogbos > > ______________________________________________ > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code.
Hi, A terrific resource for this type of issue (and pretty much anything related to R) is http://rseek.org/ I'm sure I use it at least daily. Check out ... http://rseek.org/?q=pointsToRaster The first hit is about pointsToRaster() - it has been replaced by raster::rasterize() Cheers, Ben> On Apr 30, 2016, at 4:28 AM, Ogbos Okike <giftedlife2014 at gmail.com> wrote: > > Dear All, > I have a script that draws longitude and latitude of lightning > occurrence. This script was running fine before. But when I changed my > system and do a fresh install on another laptop, this error persist. > source("script") > Error in eval(expr, envir, enclos) : > could not find function "pointsToRaster" > > I have tried to see if there is any other package I need to install > to take of the problem, I could not see. Already, when I installed > raster, it installed its dependencies such as sp. > Can any body please bail me out. > > Thanks > Ogbos > > ______________________________________________ > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code.Ben Tupper Bigelow Laboratory for Ocean Sciences 60 Bigelow Drive, P.O. Box 380 East Boothbay, Maine 04544 http://www.bigelow.org
Dear All, Thanks for your inputs. I did replace pointsToRaster () with raster::rasterize(). Below is part of my script. But I got another error: Error in (function (classes, fdef, mtable) : unable to find an inherited method for function ?rasterize? for signature ?"RasterLayer", "matrix"? Thank you for more inputs. Ogbos k<-read.table("Lat05w3.txt") colnames(k)<-c("y","x") xy<-cbind(k$x,k$y) library(raster) r<-raster() #library(sp) pr<-raster::rasterize(r,xy) #pr<-pointsToRaster(r,xy) library(maps) w = map("world") wc = cbind(w$x, w$y) wc=wc[!is.na(wc[,1]),] write.table(wc, file = "my.fileb", sep=" ",row=FALSE,col=FALSE) my<-read.table("my.out",col.names=c("a","b")) rena = function(X,Z){ Y=rep(NA,length(X)) Y[!is.na(X)]=Z Y } On 4/30/16, Ben Tupper <btupper at bigelow.org> wrote:> Hi, > > A terrific resource for this type of issue (and pretty much anything related > to R) is http://rseek.org/ I'm sure I use it at least daily. Check out > ... > > http://rseek.org/?q=pointsToRaster > > The first hit is about pointsToRaster() - it has been replaced by > raster::rasterize() > > Cheers, > Ben > >> On Apr 30, 2016, at 4:28 AM, Ogbos Okike <giftedlife2014 at gmail.com> >> wrote: >> >> Dear All, >> I have a script that draws longitude and latitude of lightning >> occurrence. This script was running fine before. But when I changed my >> system and do a fresh install on another laptop, this error persist. >> source("script") >> Error in eval(expr, envir, enclos) : >> could not find function "pointsToRaster" >> >> I have tried to see if there is any other package I need to install >> to take of the problem, I could not see. Already, when I installed >> raster, it installed its dependencies such as sp. >> Can any body please bail me out. >> >> Thanks >> Ogbos >> >> ______________________________________________ >> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see >> https://stat.ethz.ch/mailman/listinfo/r-help >> PLEASE do read the posting guide >> http://www.R-project.org/posting-guide.html >> and provide commented, minimal, self-contained, reproducible code. > > Ben Tupper > Bigelow Laboratory for Ocean Sciences > 60 Bigelow Drive, P.O. Box 380 > East Boothbay, Maine 04544 > http://www.bigelow.org > >