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,
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
-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
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
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
, 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
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
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
8 matches
Mail list logo