I had a column of data as follows:
141523
146785
143667
65560
88524
148422
151664
. . . .
I used the ts() function to convert this data into a time series.
{
Aclines <- read.csv(file.choose())
Aclinests <- ts(Aclines[[1]], start = c(2013), end = c(2015), frequency = 52)
}
head(Aclines) gives me the following output:
X141.523
1 146785
2 143667
3 65560
4 88524
5 148422
6 151664
head(Aclinests) gives me the following output:
[1] 26 16 83 87 35 54
The output of all my further analysis including graphs and predictions are scaled to how you can see the head(Aclinets) output. How can I scale the outputs back to how the original data was input? Am I missing something while converting the data to a ts?
It is typically recommended to have a reproducible example How to make a great R reproducible example?. But I will try to help based what I'm reading. If it isn't helpful, I'll delete the post.
First, the read.csv
defaults to header = TRUE
. It doesn't look like you have a header in your file. Also, it looks like R is reading data in as factors instead of numeric.
So you can try a couple of parameters to reading the file -
Aclines <- read.csv(file.choose(), header=FALSE, stringsAsFactors=FALSE)
Then to get your time series
Aclinests <- ts(Aclines[, 2], start = c(2013), end = c(2015), frequency = 52)
Since your data looks like it has 2 columns, this will read the second column of your data frame into a ts
object.
Hope this helps.