Re: [R] more on vector vs array

From: Patrick Burns <pburns_at_pburns.seanet.com>
Date: Tue 09 Aug 2005 - 19:16:15 EST

If 'thr' were a vector with the stations as names, then you could do (untested):

above <- dataframe1[, 'temp'] > thr[as.character(dataframe1[, 'station'])]

Patrick Burns
patrick@burns-stat.com
+44 (0)20 8525 0696
http://www.burns-stat.com
(home of S Poetry and "A Guide for the Unwilling S User")

alessandro carletti wrote:

>Ok, thanks,
>I'll try with a simplier example:
>
>I have a vector with 4 levels
>
>dataframe 1
>station temp
>aaa 12
>aaa 13
>bbb 12
>bbb 20
>aaa 23
>bbb 21
>ccc 30
>ccc 18
>ddd 15
>aaa 11
>ddd 15
>ddd 10
>
>
>and a thresholds vector
>
>station thr
>aaa 20
>bbb 18
>ccc 25
>ddd 10
>
>
>I vant to select from dataframe 1 each value (level by
>level) > its own threshold value.
>How to do it automatically? (vector temp and vector
>thr have different length)
>
>Thanks
>
>______________________________________________
>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
>
>
>
>
>



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 Aug 09 19:20:08 2005

This archive was generated by hypermail 2.1.8 : Sun 23 Oct 2005 - 15:10:41 EST