-1

I am having trouble understand how to set the start and end times correctly as well as the frequency. I have an excel worksheet with 2500 measurements at 0.00001 seconds each for a total of 5 periods with 500 measurements per period. I have saved the table on Data1 for reference. Data1 has 17 columns in total. Using R x64 3.3.1.

ts1 <- ts(x, start=c(0.00001), end=c(0.005), frequency=500)
#Error in ts(x, start = c(1e-05), end = c(0.005), frequency = 500) : 
#  invalid time series parameters specified

For example:

    x <- [0.404, 0.420, 0.432, 0.466, 0.456, 0.455, 0.464,(has 2493 more values here)]

represented as a time series object with measurement at 0.00001 seconds with a total of 2500 measurements. That is the exact output that I want. To make that vector into a time series object. The time series function works for date but not when I want seconds which I believe is changed in the start and end times as well as the frequency. What are the parameters used for microsecond measurements? What would be the associated frequency for microsecond measurements?

I have tried variations of the line as well checking for syntax but with no luck. Any ideas?

  • 2
    Please provide reproducible data and code as an example. – Hack-R Jul 17 '16 at 05:06
  • 1
    Welcome to SO. Have a look at this post for how to create a reproducible example: http://stackoverflow.com/a/5963610/2773500. – MikeRSpencer Jul 17 '16 at 17:29
  • Im not sure what more you want to answer this question. The data is there and the measurements can be seen. What else would you need to better understand the question and provide an answer concerning formatting? – Vineeth Thodimeladinne Jul 17 '16 at 18:22
  • Can you amend your question to include what you want your output to look like? Specifically, how do you want the existing data grouping to half second intervals? – MikeRSpencer Jul 17 '16 at 18:27
  • The data isn't in a format that we can handle, please provide a reproducible example! http://stackoverflow.com/help/mcve – Cyrus Mohammadian Jul 17 '16 at 18:34
  • I am not sure. Still fairly new to R but from my understanding the time series object is able to store values given a certain period for which the values are supposed to repeat. I am trying to do time series decomposition on my data and create a plot which from my understanding first requires a time series object. – Vineeth Thodimeladinne Jul 17 '16 at 18:36

1 Answers1

0

ts1 <- ts(Data1, start=(0.00001,0.00001), end=0.005, frequency=16)

For me your line would be like this, as "frecuency: is the number of observations per unit of time" see (https://stat.ethz.ch/R-manual/R-devel/library/stats/html/ts.html). Also the "start", needs a second parameter that is the step, so that way i think the time series would take 500 steps to reach the end value.

Tangent3
  • 1,003
  • 2
  • 9
  • 13
  • Got an error ts1 <- ts(x, start=(0.00001,0.00001), end=0.005, frequency=16) Error: unexpected ',' in "ts1 <- ts(x, start=(0.00001," – Vineeth Thodimeladinne Jul 17 '16 at 19:07
  • thats why you should provide us with a reproducible example! @Vineeth – Cyrus Mohammadian Jul 17 '16 at 19:49
  • I understand but I don't quite get what a reproducible example would be in this case. The data in question is irrelevant as the data points can be any values, the issue is with the parameters themselves. What would be an appropriate example and what kind of code are you looking for? – Vineeth Thodimeladinne Jul 17 '16 at 20:11
  • Youre rigth, I'm sorry Ii get it wrong, you have to adjust the frecuency to a defined time scale e.g. a second and assign the number of steps. http://stats.stackexchange.com/questions/120806/frequency-value-for-seconds-minutes-intervals-data-in-r ... I`m just brainstorming, I hope someone here gave you a much better guidance. – Tangent3 Jul 17 '16 at 22:29
  • Thank you for the link. I believe I created the correct time series object due to the explanations present on that link. All the best! – Vineeth Thodimeladinne Jul 18 '16 at 23:05