[R] Creation of a vector of time series from a data frame

monthodon foussereauxj at hotmail.com
Tue Jul 31 16:57:18 CEST 2012


I am a new user of R. I am trying to create a vector of time series called
"LTot" from a data frame. The purpose is to call LTot element from a loop 
to make multiple regressions over a large number of regressors. Here a piece
of R code

OGData <- read.table("heartatk4R.txt", header=TRUE)
OGCol <- ncol(OGData)
OGRow <- nrow(OGData)
# Definition of the time series vector
# assignment of each column of the data frame to an element of the time
series vector
for (i in 1:OGCol) {LTot[1:OGRow,i] <- ts(OGData[,i]);}

When I run R, I got the following error message:

Error in LTot[1:OGRow, i] <- ts(OGData[, i]) : subscript out of bounds

I will appreciate it if somebody could help me on this issue.

Thank you.


View this message in context: http://r.789695.n4.nabble.com/Creation-of-a-vector-of-time-series-from-a-data-frame-tp4638543.html
Sent from the R help mailing list archive at Nabble.com.

More information about the R-help mailing list