Hi, I am trying to create a STFDF object and draw variogram. However, I am getting several errors. Here is my r code: #create count data c0157ts <- as.numeric(c(t(c0157))) c0001ts <- as.numeric(c(t(c0001)))
#create coordinates lat <- 0 lon <- 0 lat[1] <- 34.0793684 lon[1] <- -81.1301722 lat[2] <- 33.979127 lon[2] <- -81.321166398 sp <- data.frame(lat,lon) coordinates(sp)=~lon+lat projection(sp)=CRS("+init=epsg:4326") #create time object time_index <- seq(from = as.POSIXct("2017-01-02 01:00", tz = 'UTC'), to = as.POSIXct("2017-03-22 00:00", tz = 'UTC'), by = "hour") #combine the data mydata <- data.frame("count"=c(c0157ts,c0001ts)) #create STFDF object stfdf = STFDF(ozoneSP, time_index, mydata) #trying to create variogram var <- variogramST(count~1,data=stfdf,tunit="hours",assumeRegular=F,na.omit=T)which gives me following error:0%Error in apply(do.call(cbind, lapply(ret, function(x) x$np)), 1, sum, : dim(X) must have a positive length I guess my STFDF object creation is not correct. Can anyone give us any hint? Which elements in STFDF object is not correct.Here is the description of STFDF object:> str(stfdf) Formal class 'STFDF' [package "spacetime"] with 4 slots ..@ data :'data.frame': 3792 obs. of 1 variable: .. ..$ count: num [1:3792] 40 32 64 40 55 89 71 43 69 44 ... ..@ sp :Formal class 'SpatialPoints' [package "sp"] with 3 slots .. .. ..@ coords : num [1:2, 1:2] -9031369 -9052631 4015522 4002120 .. .. .. ..- attr(*, "dimnames")=List of 2 .. .. .. .. ..$ : NULL .. .. .. .. ..$ : chr [1:2] "lon" "lat" .. .. ..@ bbox : num [1:2, 1:2] -9052631 4002120 -9031369 4015522 .. .. .. ..- attr(*, "dimnames")=List of 2 .. .. .. .. ..$ : chr [1:2] "lon" "lat" .. .. .. .. ..$ : chr [1:2] "min" "max" .. .. ..@ proj4string:Formal class 'CRS' [package "sp"] with 1 slot .. .. .. .. ..@ projargs: chr "+init=epsg:3395 +proj=merc +lon_0=0 +k=1 +x_0=0 +y_0=0 +datum=WGS84 +units=m +no_defs +ellps=WGS84 +towgs84=0,0,0" ..@ time :An ‘xts’ object on 2017-01-02 01:00:00/2017-03-22 containing: Data: int [1:1896, 1] 1 2 3 4 5 6 7 8 9 10 ... - attr(*, "dimnames")=List of 2 ..$ : NULL ..$ : chr "timeIndex" Indexed by objects of class: [POSIXct,POSIXt] TZ: UTC xts Attributes: NULL Thanks for your help! With Regards,Rukna [[alternative HTML version deleted]] _______________________________________________ R-sig-Geo mailing list R-sig-Geo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo