[R] Problem adding a class to a POSIX vector

Frank E Harrell Jr fharrell at virginia.edu
Tue Sep 3 20:58:47 CEST 2002


Under 

platform i686-pc-linux-gnu
arch     i686             
os       linux-gnu        
system   i686, linux-gnu  
status                    
major    1                
minor    5.1              
year     2002             
month    06               
day      17               
language R                

I am having the following problem.

d <- Sys.time()
w <- data.frame(d)
class(w[['d']]) <- c('labelled',class(w[['d']]))
class(w[['d']])
[1] "POSIXt"  "POSIXct"

whereas the $ method works:

class(w$d) <- c('labelled',class(w$d))
class(w[['d']])
[1] "labelled" "POSIXt"   "POSIXct" 

Is this a bug?  Does anyone know of a workaround?  Thanks.
-- 
Frank E Harrell Jr              Prof. of Biostatistics & Statistics
Div. of Biostatistics & Epidem. Dept. of Health Evaluation Sciences
U. Virginia School of Medicine  http://hesweb1.med.virginia.edu/biostat
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list