[R-sig-Geo] Error in model frame while using ppm function

vikram ranga babuawara at gmail.com
Fri Mar 15 07:33:48 CET 2013


Dear list,

I am having this error while running ppm function from spatstat package:

Error in model.frame.default(formula = fmla, data = glmdata, subset =
.mpl.SUBSET,  :
  variable lengths differ (found for 'variables$var1')

What i was trying to do:- is shown using toy example:
#require(spatstat) #require(sp)
a<-owin(poly = list(list(x = c(1, 8, 1), y = c(1, 1, 8)),list(x = c(3,
3, 4, 4), y = c(3, 4, 4, 3)),list(x=c(0,0.8,0),y=c(0,0,3)))) # makes
polygons
p<-rpoispp(a) # planar points
a.im<-as.im(a)
p<-rpoispp(a.im)
var1<-runif(p$n)
var2<-runif(p$n)
var3<-runif(p$n)
variables<-cbind(var1,var2,var3)
ppm.test<-ppm(p,~variables$var1+variables$var2+variables$var3,data=variables,method="ho")

Error in model.frame.default(formula = fmla, data = glmdata, subset =
.mpl.SUBSET,  :
  variable lengths differ (found for 'variables$var1')

However, the length of variables do not differ with ppp "p" but error
shows variable lengths differ.
I could not figure out why r throwing this error


The session info is:
R version 2.15.2 (2012-10-26)
Platform: i386-w64-mingw32/i386 (32-bit)

locale:
[1] LC_COLLATE=English_India.1252  LC_CTYPE=English_India.1252
[3] LC_MONETARY=English_India.1252 LC_NUMERIC=C
[5] LC_TIME=English_India.1252

attached base packages:
[1] grid      stats     graphics  grDevices utils     datasets  methods
[8] base

other attached packages:
 [1] data.table_1.8.8 raster_2.0-41    rgdal_0.8-4      maptools_0.8-22
 [5] lattice_0.20-10  foreign_0.8-51   rgeos_0.2-12     sp_1.0-5
 [9] spatstat_1.31-0  deldir_0.0-21    mgcv_1.7-22

loaded via a namespace (and not attached):
[1] Matrix_1.0-9 nlme_3.1-105 tools_2.15.2



Any help is greatly appreciated.

Vikram.



More information about the R-sig-Geo mailing list