[R] uneven vector length issue with read.zoo?
Rui Barradas
ruipbarradas at sapo.pt
Thu May 3 01:19:38 CEST 2012
Hello,
knavero wrote
>
> case (6) - regress back to read.table apparently....
>
Or to readLines.
tmp <- readLines("http://dl.dropbox.com/u/41922443/test.csv")
# Why doesn't it work?
sapply(strsplit(tmp, ","), length)
# Don't argue with computers, they don't listen.
tmp <- tmp[-1]
tmp <- strsplit(tmp, ",")
tmp <- do.call(rbind, tmp)
nms <- tmp[1, ]
tmp <- tmp[-1, ]
tmp <- data.frame(tmp, stringsAsFactors=FALSE)
colnames(tmp) <- nms
# Now see what we've got
str(tmp) # Messy: one col without a name, dates and nums are chars, etc.
Hope this helps,
Rui Barradas
--
View this message in context: http://r.789695.n4.nabble.com/uneven-vector-length-issue-with-read-zoo-tp4604287p4604720.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list