[R] Fetching datapoints from a Time Series
Hi all, I have a time series like that : DateValue 01/03/05 -0.008471364 01/04/05 -0.008153802 01/05/05 -0.000780031 01/06/05 -0.000130064 01/07/05 -0.000650576 01/08/05 -0.000130166 01/10/05 -0.004174282 01/11/05 0.01027384 01/12/05 -0.006099558 01/13/05 -0.009811054 01/14/05 0.000657073 I import this dataset as a zoo object. Now I want to fetch the dataset between two particular dates. For example if I want to get data point between 01/02/05 and 01/09/05 I should get : 01/03/05 -0.008471364 01/04/05 -0.008153802 01/05/05 -0.000780031 01/06/05 -0.000130064 01/07/05 -0.000650576 01/08/05 -0.000130166 Can anyone please tell me how to do that? Is there any function to do that? Regards, __ [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Fetching datapoints from a Time Series
Hi all, I have a time series like that : DateValue 01/03/05 -0.008471364 01/04/05 -0.008153802 01/05/05 -0.000780031 01/06/05 -0.000130064 01/07/05 -0.000650576 01/08/05 -0.000130166 01/10/05 -0.004174282 01/11/05 0.01027384 01/12/05 -0.006099558 01/13/05 -0.009811054 01/14/05 0.000657073 I import this dataset as a zoo object. Now I want to fetch the dataset between two particular dates. For example if I want to get data point between 01/02/05 and 01/09/05 I should get : 01/03/05 -0.008471364 01/04/05 -0.008153802 01/05/05 -0.000780031 01/06/05 -0.000130064 01/07/05 -0.000650576 01/08/05 -0.000130166 Can anyone please tell me how to do that? Is there any function to do that? Regards, __ [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Fetching datapoints from a Time Series
Hi all, I have a time series like that : DateValue 01/03/05 -0.008471364 01/04/05 -0.008153802 01/05/05 -0.000780031 01/06/05 -0.000130064 01/07/05 -0.000650576 01/08/05 -0.000130166 01/10/05 -0.004174282 01/11/05 0.01027384 01/12/05 -0.006099558 01/13/05 -0.009811054 01/14/05 0.000657073 I import this dataset as a zoo object. Now I want to fetch the dataset between two particular dates. For example if I want to get data point between 01/02/05 and 01/09/05 I should get : 01/03/05 -0.008471364 01/04/05 -0.008153802 01/05/05 -0.000780031 01/06/05 -0.000130064 01/07/05 -0.000650576 01/08/05 -0.000130166 Can anyone please tell me how to do that? Is there any function to do that? Regards, __ [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Fetching datapoints from a Time Series
Hi all, I have a time series like that : DateValue 01/03/05 -0.008471364 01/04/05 -0.008153802 01/05/05 -0.000780031 01/06/05 -0.000130064 01/07/05 -0.000650576 01/08/05 -0.000130166 01/10/05 -0.004174282 01/11/05 0.01027384 01/12/05 -0.006099558 01/13/05 -0.009811054 01/14/05 0.000657073 I import this dataset as a zoo object. Now I want to fetch the dataset between two particular dates. For example if I want to get data point between 01/02/05 and 01/09/05 I should get : 01/03/05 -0.008471364 01/04/05 -0.008153802 01/05/05 -0.000780031 01/06/05 -0.000130064 01/07/05 -0.000650576 01/08/05 -0.000130166 Can anyone please tell me how to do that? Is there any function to do that? Regards, [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Fetching datapoints from a Time Series
Hi all, I have a time series like that : DateValue 01/03/05 -0.008471364 01/04/05 -0.008153802 01/05/05 -0.000780031 01/06/05 -0.000130064 01/07/05 -0.000650576 01/08/05 -0.000130166 01/10/05 -0.004174282 01/11/05 0.01027384 01/12/05 -0.006099558 01/13/05 -0.009811054 01/14/05 0.000657073 I import this dataset as a zoo object. Now I want to fetch the dataset between two particular dates. For example if I want to get data point between 01/02/05 and 01/09/05 I should get : 01/03/05 -0.008471364 01/04/05 -0.008153802 01/05/05 -0.000780031 01/06/05 -0.000130064 01/07/05 -0.000650576 01/08/05 -0.000130166 Can anyone please tell me how to do that? Is there any function to do that? Regards, __ [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Fetching datapoints from a Time Series
Maybe ?window --- Megh Dal [EMAIL PROTECTED] wrote: Hi all, I have a time series like that : DateValue 01/03/05 -0.008471364 01/04/05 -0.008153802 01/05/05 -0.000780031 01/06/05 -0.000130064 01/07/05 -0.000650576 01/08/05 -0.000130166 01/10/05 -0.004174282 01/11/05 0.01027384 01/12/05 -0.006099558 01/13/05 -0.009811054 01/14/05 0.000657073 I import this dataset as a zoo object. Now I want to fetch the dataset between two particular dates. For example if I want to get data point between 01/02/05 and 01/09/05 I should get : 01/03/05 -0.008471364 01/04/05 -0.008153802 01/05/05 -0.000780031 01/06/05 -0.000130064 01/07/05 -0.000650576 01/08/05 -0.000130166 Can anyone please tell me how to do that? Is there any function to do that? Regards, __ [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Fetching datapoints from a Time Series
x - read.table(tc - textConnection( DateValue + 01/03/05 -0.008471364 + 01/04/05 -0.008153802 + 01/05/05 -0.000780031 + 01/06/05 -0.000130064 + 01/07/05 -0.000650576 + 01/08/05 -0.000130166 + 01/10/05 -0.004174282 + 01/11/05 0.01027384 + 01/12/05 -0.006099558 + 01/13/05 -0.009811054 + 01/14/05 0.000657073), header=TRUE) close(tc) y - zoo(x[,2], as.Date(as.character(x[,1]), '%m/%d/%y')) y[index(y) = as.Date('2005-01-02') index(y) = as.Date('2005-01-09')] 2005-01-03 2005-01-04 2005-01-05 2005-01-06 2005-01-07 2005-01-08 -0.008471364 -0.008153802 -0.000780031 -0.000130064 -0.000650576 -0.000130166 On 10/24/07, Megh Dal [EMAIL PROTECTED] wrote: Hi all, I have a time series like that : DateValue 01/03/05 -0.008471364 01/04/05 -0.008153802 01/05/05 -0.000780031 01/06/05 -0.000130064 01/07/05 -0.000650576 01/08/05 -0.000130166 01/10/05 -0.004174282 01/11/05 0.01027384 01/12/05 -0.006099558 01/13/05 -0.009811054 01/14/05 0.000657073 I import this dataset as a zoo object. Now I want to fetch the dataset between two particular dates. For example if I want to get data point between 01/02/05 and 01/09/05 I should get : 01/03/05 -0.008471364 01/04/05 -0.008153802 01/05/05 -0.000780031 01/06/05 -0.000130064 01/07/05 -0.000650576 01/08/05 -0.000130166 Can anyone please tell me how to do that? Is there any function to do that? Regards, __ [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem you are trying to solve? __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Fetching datapoints from a Time Series
One comment first: Sending a request to the list *once* is sufficient! As for the question: A slight modification of Jim's solution... x - read.table(tc - textConnection( DateValue + 01/03/05 -0.008471364 + 01/04/05 -0.008153802 + 01/05/05 -0.000780031 + 01/06/05 -0.000130064 + 01/07/05 -0.000650576 + 01/08/05 -0.000130166 + 01/10/05 -0.004174282 + 01/11/05 0.01027384 + 01/12/05 -0.006099558 + 01/13/05 -0.009811054 + 01/14/05 0.000657073), header=TRUE) close(tc) y - zoo(x[,2], as.Date(as.character(x[,1]), '%m/%d/%y')) y[index(y) = as.Date('2005-01-02') index(y) = as.Date('2005-01-09')] 2005-01-03 2005-01-04 2005-01-05 2005-01-06 2005-01-07 2005-01-08 -0.008471364 -0.008153802 -0.000780031 -0.000130064 -0.000650576 -0.000130166 A slightly shorter and maybe a bit more evocative solution (based on the same text file/connection) is y - read.zoo(tc, header = TRUE, format = %m/%d/%y) window(y, start = as.Date(2005-01-02), end = as.Date(2005-01-09)) See also vignette(zoo, package = zoo) for more details. hth, Z __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.