示例来自 Phil Specter 的非常棒的书“David Manipulation with R”,但出现了一个错误。
#write a gzipped csv file created from a data frame
gfile = gzfile("mydata.gz")
write.table("mydata, sep = ",", file = gfile")
#Goal is to test a conversion from char to Date objects with function textConnection()
sample = textConnection("2002-2-29 1 0
2002-4-29 1 5
2004-10-4 2 0")
read.table(sample, colClasses = c("Date", NA, NA))
Error in charToDate(x) :
character string is not in a standard unambiguous format
#next mydata = scan(unz("data.zip", "mydata.txt"))