Xiaobo Gu
2011-Nov-20 04:42 UTC
[R] write.arff function in package foreign can't handle Date time
Hi,
x1 <-
c(as.Date("20110101","%Y%m%d"),as.Date("2012-01-01","%Y-%m-%d"));
x2 <- c("1","2");
ddf <- data.frame(x=x1,y=x2);
ddf[["y"]] <- as.factor(ddf[["y"]])
write.arff(ddf, file="D:/ddf.arff")
Content of ddf.arff is
@relation ddf
@attribute x numeric
@attribute y {'1','2'}
@data
2011-01-01,'1'
2012-01-01,'2'
Here x is of type Date, but write.arff write it as numeric, but the actual
content is string, the result file is not with valid ARFF file format(Weka
can't read it in).
I think write.arff should write it as @attribute x DATE "yyyy-MM-dd"
Regards
Xiaobo Gu
[[alternative HTML version deleted]]
