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