[R] Converting data frame to its object results in matrix of strings

Noah Silverman noahsilverman at ucla.edu
Fri Apr 6 19:13:46 CEST 2012


Hi,

I have a rather large data frame (500 x 5000) that I want to convert to a proper xts object.

I am able to properly generate an xts object with the correct time index.  However, all of my numerical values are now strings.

b <- as.xts(a[,2:dim(a)[2]], order.by=as.POSIXct(strptime(paste(a$Date), '%m/%d/%Y')))

My guess is that somewhere in the large data frame there are a few strings hiding that is causing the who thong to be converted to string.

Is there some way to force the as.xts function to ignore the strings and keep everything numeric?


Thanks!


--
Noah Silverman
UCLA Department of Statistics
8208 Math Sciences Building
Los Angeles, CA 90095



More information about the R-help mailing list