Re: [R] Replacing elements of a list over a certain threshold

2010-06-22 Thread William Dunlap
> -Original Message- > From: r-help-boun...@r-project.org > [mailto:r-help-boun...@r-project.org] On Behalf Of David Winsemius > Sent: Tuesday, June 22, 2010 11:24 AM > To: johan...@huesing.name > Cc: r-help@r-project.org > Subject: Re: [R] Replacing elements of

Re: [R] Replacing elements of a list over a certain threshold

2010-06-22 Thread David Winsemius
On Jun 22, 2010, at 2:14 PM, Johannes Huesing wrote: Jim Hargreaves [Mon, Jun 21, 2010 at 12:34:01PM CEST]: Dear List, I have a list of length ~1000 filled with numerics. I need to replace the elements of this list that are above a certain numerical threshold with the value of the threshold

Re: [R] Replacing elements of a list over a certain threshold

2010-06-22 Thread Johannes Huesing
Jim Hargreaves [Mon, Jun 21, 2010 at 12:34:01PM CEST]: > Dear List, > > I have a list of length ~1000 filled with numerics. I need to > replace the elements of this list that are above a certain numerical > threshold with the value of the threshold. > > e.g > example=list(1, 2, 3, 4, 5, 6, 7, 8,

Re: [R] Replacing elements of a list over a certain threshold

2010-06-21 Thread Henrique Dallazuanna
Try this also: replace(example, example > threshold, threshold) On Mon, Jun 21, 2010 at 7:34 AM, Jim Hargreaves wrote: > Dear List, > > I have a list of length ~1000 filled with numerics. I need to replace the > elements of this list that are above a certain numerical threshold with the > value

Re: [R] Replacing elements of a list over a certain threshold

2010-06-21 Thread Joris Meys
r2<-sapply(r,filt,thres=5)) >   user  system elapsed >   3.36    0.00    3.66 >> head(r2) > [1] 3 5 5 3 2 5 > > > To return a list, replace "sapply" with "lapply" > > Christos > > > >> Date: Mon, 21 Jun 2010 11:34:01 +0100 >> Fr

Re: [R] Replacing elements of a list over a certain threshold

2010-06-21 Thread Christos Argyropoulos
eturn a list, replace "sapply" with "lapply" Christos > Date: Mon, 21 Jun 2010 11:34:01 +0100 > From: ja...@ipec.co.uk > To: r-help@r-project.org > Subject: [R] Replacing elements of a list over a certain threshold > > Dear List, > > I have a li

Re: [R] Replacing elements of a list over a certain threshold

2010-06-21 Thread Joris Meys
"magic" code: example[example>threshold] <-threshold Cheers Joris On Mon, Jun 21, 2010 at 12:34 PM, Jim Hargreaves wrote: > Dear List, > > I have a list of length ~1000 filled with numerics. I need to replace the > elements of this list that are above a certain numerical threshold with the > val

[R] Replacing elements of a list over a certain threshold

2010-06-21 Thread Jim Hargreaves
Dear List, I have a list of length ~1000 filled with numerics. I need to replace the elements of this list that are above a certain numerical threshold with the value of the threshold. e.g example=list(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1) threshold=5 example=(1, 2, 3, 4,