[R] extract certain values from a ts

antonio rodriguez antonio.raju at gmail.com
Tue Oct 24 20:49:07 CEST 2006


Leeds, Mark (IED) escribió:
> take your ts object and convert it to a zoo object ( you need to have the zoo package and chron which it depends on installed) 
> using
>
> WS<-as.zoo(WS).
>
> Then , use the command the I gave you earlier. I think that should retain the dates.
> If that doesn't work, ask Gabor because he can tell you for sure.
>
> In general, keeping things as zoo objects allows you to retain date info quite nicely.
>   
You are right! Yes it keeps the year and the day. Luckily zoo is free :-))

Best regards!!

Antonio


> If zoo weren't free, I could work as a salesman for Gabor.
>
>
>
>
>
> -----Original Message-----
> From: antonio rodriguez [mailto:antonio.raju at gmail.com] 
> Sent: Tuesday, October 24, 2006 2:22 PM
> To: Leeds, Mark (IED); R-Help
> Subject: Re: [R] extract certain values from a ts
>
> Leeds, Mark (IED) escribió:
>   
>> I don't think it matters whether it's a ts or a  vector.
>>
>> WS<-WS[ ( WS > 5 ) & ( WS < 8 ) ]
>>
>> Check to make sure it works.
>>   
>>     
> Dear Mark,
>
> Yes it works. But I think that it matters for a ts since I want to know the days when those values where observed. The above solution gives me the number of days when those values were observed but not the days when they were observed. It is important to me to know if, for example, in april 1999, I had 3 periods with winds blowing below 8 m/s and over 5 m/s.
>
> Best regards!
>
> Antonio
>
>
>   
>> -----Original Message-----
>> From: r-help-bounces at stat.math.ethz.ch 
>> [mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of antonio 
>> rodriguez
>> Sent: Tuesday, October 24, 2006 1:57 PM
>> To: r-help at stat.math.ethz.ch
>> Subject: [R] extract certain values from a ts
>>
>> Hi,
>>
>> Having several daily wind speed time series I want to extract those 
>> consecutive days over and below certain values (i.e. 5 < x <8) Don't 
>> know which funtion to use (aggregate, lapply?) and how to do it.
>>
>> Thanks in advance
>>
>> Antonio
>>
>> ______________________________________________
>> R-help at stat.math.ethz.ch 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.
>> --------------------------------------------------------
>>
>> This is not an offer (or solicitation of an offer) to buy/sell the securities/instruments mentioned or an official confirmation.  Morgan Stanley may deal as principal in or own or act as market maker for securities/instruments mentioned or may advise the issuers.  This is not research and is not from MS Research but it may refer to a research analyst/research report.  Unless indicated, these views are the author's and may differ from those of Morgan Stanley research or others in the Firm.  We do not represent this is accurate or complete and we may not update this.  Past performance is not indicative of future returns.  For additional information, research reports and important disclosures, contact me or see https://secure.ms.com/servlet/cls.  You should not use e-mail to request, authorize or effect the purchase or sale of any security or instrument, to send transfer instructions, or to effect any other transactions.  We cannot guarantee that any such requests received via e-mail will be processed in a timely manner.  This communication is solely for the addressee(s) and may contain confidential information.  We do not waive confidentiality by mistransmission.  Contact me if you do not wish to receive these communications.  In the UK, this communication is directed in the UK to those persons who are market counterparties or intermediate customers (as defined in the UK Financial Services Authority's rules).
>>
>>
>>     
> --------------------------------------------------------
>
> This is not an offer (or solicitation of an offer) to buy/sell the securities/instruments mentioned or an official confirmation.  Morgan Stanley may deal as principal in or own or act as market maker for securities/instruments mentioned or may advise the issuers.  This is not research and is not from MS Research but it may refer to a research analyst/research report.  Unless indicated, these views are the author's and may differ from those of Morgan Stanley research or others in the Firm.  We do not represent this is accurate or complete and we may not update this.  Past performance is not indicative of future returns.  For additional information, research reports and important disclosures, contact me or see https://secure.ms.com/servlet/cls.  You should not use e-mail to request, authorize or effect the purchase or sale of any security or instrument, to send transfer instructions, or to effect any other transactions.  We cannot guarantee that any such requests received via e-mail will be processed in a timely manner.  This communication is solely for the addressee(s) and may contain confidential information.  We do not waive confidentiality by mistransmission.  Contact me if you do not wish to receive these communications.  In the UK, this communication is directed in the UK to those persons who are market counterparties or intermediate customers (as defined in the UK Financial Services Authority's rules).
>
>



More information about the R-help mailing list