0

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?

threesixnine
  • 1,733
  • 7
  • 30
  • 56

1 Answers1

0

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.

Community
  • 1
  • 1
Whitebeard
  • 5,945
  • 5
  • 24
  • 31
  • Thank you for your answer. I am new to R and stackoverflow and I will keep what you told me in mind about reproducible examples. Your answer helped me partially. I now get my input values of the original data in my time-series as well. However, when I use the 'plot' function I get an error which I have asked using a reproducible example in this question: Please let me know if you can have a look. – Achyutha Mohan Sep 01 '15 at 20:11