Skip to content

Could not find function "pointsToRaster"

5 messages · Ogbos Okike, Leonardo Ferreira Fontenelle, Ben Tupper

#
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
#
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:
#
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
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,

I think you need to check the order of your arguments to rasterize().  See the documentation with ?rasterize and compare to what you did below.

Cheers,
Ben
Ben Tupper
Bigelow Laboratory for Ocean Sciences
60 Bigelow Drive, P.O. Box 380
East Boothbay, Maine 04544
http://www.bigelow.org