Re: [R] Using the output of strsplit

2010-01-19 Thread jim holtman
'x' is a matrix and not a dataframe. You should be doing colnames(x) <- c("Date", "quarter") x[,"Date"] <- as.Date(x[,"Date"]) It would help if you took a look at the structure you were using to understand how to access. 'names' applied to a vector would give you the output for 13000 more entr

Re: [R] Using the output of strsplit

2010-01-19 Thread James Rome
This suggestion does not work. x seems to have twice the number of entries as spl. > x <- do.call(rbind, spl) > names(x) <- c('Date', 'quarter') > x$Date <- as.Date(x$Date) Error in x$Date : $ operator is invalid for atomic vectors > x$quarter <- as.numeric(x$quarter) Error in x$quarter : $ operato

Re: [R] Using the output of strsplit

2010-01-18 Thread Henrique Dallazuanna
Try this also: do.call(rbind, spl) On Mon, Jan 18, 2010 at 7:48 PM, James Rome wrote: > I successfully combined my data frames, and am now on my next hurdle. > > I had combined the data and quarter, and used tapply to count the > entries for each unique date/quarter pair. > ar= tapply(ewrgnd$gw,

Re: [R] Using the output of strsplit

2010-01-18 Thread Peter Alspach
Tena koe Jim You could use unlist and matrix. For example: > tempList [[1]] [1] "a" "A" [[2]] [1] "b" "B" [[3]] [1] "c" "C" > unlist(tempList) [1] "a" "A" "b" "B" "c" "C" > matrix(unlist(tempList), nrow=3) [,1] [,2] [1,] "a" "B" [2,] "A" "c" [3,] "b" "C" > matrix(unlist(tempList),