2
I’m trying to put three time series together in one, but I’m having a lot of problems.
I used the junction c
of R, but it is not useful to me because as it comes to monthly series, this command mixes the observations of the three series and becomes a mess.
I used the package plyr and the skinny to create a data.frame
containing the three previous series as columns, but with the first package, the function join_all
returned me a data.frame
empty, and with the second R says that the series parameters are invalid (ps.: but they contain the same dimension).
Below I leave the commands I used for a better understanding:
cimento <- read.table(file='cimento.csv', sep=';', header=T)
Carbono01 <- (300 + (0.2*cimento))
Carbono02 <- (300 + (0.2*(cimento^2/2)))
Carbono03 <- (300 + (0.2*cimento) + (cimento^2/4000))
Carbono01 <- as.data.frame(Carbono01)
Carbono02 <- as.data.frame(Carbono02)
Carbono03 <- as.data.frame(Carbono03)
install.packages("plyr")
library(plyr)
carbono <- join_all(list(Carbono01, Carbono02,Carbono03))
carbono
rm(carbono)
install.packages("magrittr")
library(magrittr)
carbono <- Carbono01%>%merge(Carbono02)%>%merge(Carbono03)
carbono
Edit: str(cimento)
Time-Series [1:242] from 1996 to 2016: 3391 3436 3630 3677 3460 3308 3645 3707 3677 3629 ...
Welcome to Stackoverflow! Unfortunately, this question cannot be reproduced by anyone trying to answer it. Please, take a look at this link and see how to ask a reproducible question in R. So, people who wish to help you will be able to do this in the best possible way.
– Marcus Nunes
updates the question with the result of
str(cimento)
– Robert
Done...........
– Leonardo Vinícius
Try
Carbono01 <- data.frame(ID = seq_along(Carbono01), Carbono01)
and the same for others. Without a common column (in this caseID
) how does thejoin_all
can join df’s? And still, for time series, see the packageszoo
orxts
.– Rui Barradas
Good afternoon, buddy! I’ve been trying to do what you recommended, but the R only returns this as an answer:
Error in
[<-.ts(
tmp, ri, value = c(1150188.1, 1180909.6, 1317990, : 
 only replacement of elements is allowed
I don’t understand what’s happening.– Leonardo Vinícius