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

2010-06-22 Thread Johannes Huesing
Jim Hargreaves ja...@ipec.co.uk [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,

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 ja...@ipec.co.uk [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

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 a list over a certain threshold

[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 magic code goes here

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

2010-06-21 Thread Joris Meys
magic code: example[examplethreshold] -threshold Cheers Joris On Mon, Jun 21, 2010 at 12:34 PM, Jim Hargreaves ja...@ipec.co.uk 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

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

2010-06-21 Thread Christos Argyropoulos
, 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 list of length ~1000 filled with numerics. I need to replace the elements

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

2010-06-21 Thread Joris Meys
   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 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 list of length ~1000

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 ja...@ipec.co.uk 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