s-news
[Top] [All Lists]

[S] cut.period()

To: S+ list <s-news@wubios.wustl.edu>
Subject: [S] cut.period()
From: Jens Oehlschlaegel <oehl@Psyres-Stuttgart.DE>
Date: Wed, 29 Apr 1998 00:22:26 +0200 (MET DST)
Sender: owner-s-news@wubios.wustl.edu

here is a improved version of my recently posted cut.degrees(), which had
a hardwired 360 and rather confusing code,

any comments welcome

best, Jens Oehlschlaegel



cut.periodic <- function(d, period.start=-45, period.size=360, nclass=4,
breaks=seq(period.start,period.start+period.size,length=nclass+1)){
  # mapping and cutting of periodic data d
  # (c) JOA 1998
        # map period.start on standard period [0,360)
        standard.period.start <- period.start%%period.size  
        # map data d on standard period [0,360) 
        d <- d%%period.size
        # map standard period to desired period (period.start,
period.start+period.size]
        d <- ifelse(d<=standard.period.start, d+period.size, d)
-standard.period.start +period.start
        # cut period as desired 
        if (length(breaks)>0) cut( d, breaks, include.lowest=F)
        else d
}






--
Jens Oehlschlaegel-Akiyoshi
Psychologist/Statistician
Project TR-EAT + COST Action B6
                                                 F.rankfurt
oehl@psyres-stuttgart.de                         A.ttention
+49 711 6781-408 (phone)                         I.nventory
+49 711 6876902  (fax)                           R .-----.
                                                  / ----- \
Center for Psychotherapy Research                | | 0 0 | |
Christian-Belser-Strasse 79a                     | |  ?  | |
D-70597 Stuttgart Germany                         \ ----- /
-------------------------------------------------- '-----' -
(general disclaimer)                             it's better

-----------------------------------------------------------------------
This message was distributed by s-news@wubios.wustl.edu.  To unsubscribe
send e-mail to s-news-request@wubios.wustl.edu with the BODY of the
message:  unsubscribe s-news

<Prev in Thread] Current Thread [Next in Thread>
  • [S] cut.period(), Jens Oehlschlaegel <=