R programming language resources › Forums › Data manipulation › Creating a vector/list of time series from a data frame
- This topic has 0 replies, 1 voice, and was last updated 11 years, 9 months ago by monthodon.
- AuthorPosts
- July 26, 2012 at 9:37 pm #501monthodonMember
To whom it may concern:
I am trying to create a list (or a vector) of time series from a data frame. Here is the R code
OGData <- read.table("heartatk4R.txt", header=TRUE) OGCol <- ncol(OGData) # initialization of the list or vector of time series LTot <- c(NA,length=OGCol) # assignment of each column of the data frame to an element of the time series vector for (i in 1:OGCol) {LTot[i] <- ts(OGData[,i]);} Then I am getting the following Warning message Warning messages: 1: In LTot[i] <- ts(OGData[, i]) : number of items to replace is not a multiple of replacement length 2: In LTot[i] <- ts(OGData[, i]) : number of items to replace is not a multiple of replacement length 3: In LTot[i] <- ts(OGData[, i]) : number of items to replace is not a multiple of replacement length 4: In LTot[i] <- ts(OGData[, i]) : number of items to replace is not a multiple of replacement length 5: In LTot[i] <- ts(OGData[, i]) : number of items to replace is not a multiple of replacement length 6: In LTot[i] <- ts(OGData[, i]) : number of items to replace is not a multiple of replacement length 7: In LTot[i] <- ts(OGData[, i]) : number of items to replace is not a multiple of replacement length 8: In LTot[i] <- ts(OGData[, i]) : number of items to replace is not a multiple of replacement length and each element of the LTot vector is empty. Can this be done with the zoo time series object? Your help is appreciated on this matter. Thank you. Xavier. foussereauxj@hotmail.com
- AuthorPosts
- You must be logged in to reply to this topic.