[R] Turnpoints (pastecs): How to specify a limit on the number of tur npoints?

From: Lapointe, Pierre <Pierre.Lapointe_at_nbf.ca>
Date: Tue 17 May 2005 - 01:38:11 EST


Hello,

I'm trying to get a few turnpoints for a financial time series. There is a function in pastecs that does that. However, I get a large number of turnpoints:

library(pastecs)
data(EuStockMarkets)
dax <-EuStockMarkets[,1]
plot(dax)
turnp <-turnpoints(dax)
summary(turnp) #gives 925 peaks/pits!!!

How can specify to get only 30 turnpoints?

Second question: the extract function

extract(turnp,30)

gives me this:

> extract(turnp,30)

 [1] 0 0 -1 1 0 -1 0 1 -1 0 1 0 0 -1 0 0 1 0 0 -1 0 0 0 1 -1
[26] 1 -1 1 -1 1
Warning message:
arguments after the first two are ignored in: UseMethod("extract", e, n, ...)
>

Any odea what caused this error?

I'm on win2k,

> version

         _
platform i386-pc-mingw32

arch     i386           
os       mingw32        
system   i386, mingw32  
status   Patched        
major    2              
minor    1.0            
year     2005           
month    05             
day      09             
language R              

>

Regards,

Pierre Lapointe
Assistant Market Strategist



AVIS DE NON-RESPONSABILITE:\ Ce document transmis par courri...{{dropped}}

R-help@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 Received on Tue May 17 01:42:06 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:31:46 EST