[R-sig-Geo] problem assigning POSIX class to AttributeList column

Edzer J. Pebesma e.pebesma at geo.uu.nl
Tue Jul 18 17:49:24 CEST 2006


Michael, this missing feature is definately a bug; AttributeList objects 
were meant to resemble data.frame objects but without having a row.names 
attribute (like the data.frame in R 2.4.0 will be); POSIXct vectors are 
allowed in data.frame's.

Did you actually solve it?

Best regards,
--
Edzer

Michael Sumner wrote:

>Hello, I've been unable to use "[[<-.AttributeList" to assign POSIXct vectors.
>
>It seems to be because 
>is.vector(Sys.time()) 
>
>is FALSE.  The test "is.vector(value)" is perhaps too strict ?? but I
>don't see whether this is perhaps a problem with the datetimeClasses. 
>
>Example follows. 
>
>Cheers, Mike.
>
>
>sessionInfo()
>#Version 2.3.1 (2006-06-01) 
>#i386-pc-mingw32 
>
>#attached base packages:
>#[1] "methods"   "stats"     "graphics"  "grDevices" "utils"     "datasets" 
>#[7] "base"     
>
>#other attached packages:
>#      sp 
>#"0.8-16" 
>
>al <- AttributeList(list(x = 1:10, y = gl(2, 5), t = Sys.time() + 1:10))
>
>
>al[["t"]] <- Sys.time() + 1:10  
>#Error: is.vector(value) || is.factor(value) is not TRUE
>
>traceback()
>#4: stop(paste(deparse(mc[[i + 1]]), " is not ", if (length(r) > 
>#       1) "all ", "TRUE", sep = ""), call. = FALSE)
>#3: stopifnot(is.vector(value) || is.factor(value))
>#2: "[[<-.AttributeList"(`*tmp*`, "t", value = c(1153188132.868, 
>#   1153188133.868, 1153188134.868, 1153188135.868, 1153188136.868, 
>#   1153188137.868, 1153188138.868, 1153188139.868, 1153188140.868, 
>#   1153188141.868))
>#1: "[[<-"(`*tmp*`, "t", value = c(1153188132.868, 1153188133.868, 
>#   1153188134.868, 1153188135.868, 1153188136.868, 1153188137.868, 
>#   1153188138.868, 1153188139.868, 1153188140.868, 1153188141.868
>#   ))
>
>
>## the same problem occurs with
>al[[3]] <- Sys.time() + 1:10
>
>## and with
>
>al[["t"]] <- al[["t"]]
>
>## assigning numeric to numeric OK
>al[["x"]] <- 2:11
>
>## but assigning POSIX to same is not
>al[["x"]] <- Sys.time() + 1:10
>
>
># straight list version
>
>l <- list(x = 1:10, y = gl(2, 5), t = Sys.time() + 1:10)
>
>## works fine:
>l[["t"]] <- l[["t"]]
>
>_______________________________________________
>R-sig-Geo mailing list
>R-sig-Geo at stat.math.ethz.ch
>https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>  
>




More information about the R-sig-Geo mailing list