as.Date from data.frame
#Hello, #I loaded data using read.table - I needed to convert a row in the data frame to date class:
data
V1 V2 V3 V4 1 2008-05-19 2008-04-19 2008-03-21 2008-02-22 2 38.16999817 30.70999908 36.86000061 35.18999863 3 37.47999954 29.95000076 36.45999908 35.36000061 4 37.47999954 30.14999962 36.47000122 35.36000061 5 37.84999847 30.56999969 36.84000015 35.74000168 6 38.38999939 31.14999962 37.34000015 36.27000046 7 39.11000061 31.90999985 38.02999878 36.97999954 8 39.81000137 32.65000153 38.68000031 37.63999939 9 40.47000122 33.34999847 39.27999878 38.27000046
data[1,]
V1 V2 V3 V4 1 2008-05-19 2008-04-19 2008-03-21 2008-02-22
dates1<-as.Date(data[1,])
do not know how to convert 'dates[1,]' to class "Date" # However, I can individually convert them all:
dates1.1<-as.Date(data[1,1])
dates1.1
[1] "2008-05-19" # How can I change the class of the date over the entire row (my original file contains more than one hundred rows)? # Thank you very much.
View this message in context: http://old.nabble.com/as.Date-from-data.frame-tp26305830p26305830.html Sent from the R help mailing list archive at Nabble.com.