Date sent: Tue, 23 May 2006 16:34:04 -0300
Subject:Re: [R] conditional replacement
> Sachin,
>
> there's another slower but more flexible way than Gabor's solution:
>
> ifelse(x<30,30,ifelse(x>60,60,x))
>
> HTH,
>
> Ro
Sachin,
there's another slower but more flexible way than Gabor's solution:
ifelse(x<30,30,ifelse(x>60,60,x))
HTH,
Rogerio.
- Original Message -
From: "Sachin J" <[EMAIL PROTECTED]>
To:
Sent: Tuesday, May 23, 2006 3:40 PM
Subject: [R] conditional re
Thank you Gabor,Marc,Dimitrios and Sundar.
Sachin
Gabor Grothendieck <[EMAIL PROTECTED]> wrote:
x <- 10*1:10
pmin(pmax(x, 30), 60) # 30 30 30 40 50 60 60 60 60 60
On 5/23/06, Sachin J wrote:
> Hi
>
> How can do this in R.
>
> >df
>
> 48
> 1
> 35
> 32
> 80
>
> If df < 30 then replace it w
Sachin J wrote:
> Hi
>
> How can do this in R.
>
> >df
>
> 48
> 1
> 35
> 32
> 80
>
> If df < 30 then replace it with 30 and else if df > 60 replace it with 60.
> I have a large dataset so I cant afford to identify indexes and t
you could try something like:
ifelse(df < 30, 30, ifelse(df > 60, 60, df))
I hope it helps.
Best,
Dimitris
Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
Catholic University of Leuven
Address: Kapucijnenvoer 35, Leuven, Belgium
Tel: +32/(0)16/336899
Fax:
On Tue, 2006-05-23 at 11:40 -0700, Sachin J wrote:
> Hi
>
> How can do this in R.
>
> >df
>
> 48
> 1
> 35
> 32
> 80
>
> If df < 30 then replace it with 30 and else if df > 60 replace it
> with 60. I have a large dataset so I cant
x <- 10*1:10
pmin(pmax(x, 30), 60) # 30 30 30 40 50 60 60 60 60 60
On 5/23/06, Sachin J <[EMAIL PROTECTED]> wrote:
> Hi
>
> How can do this in R.
>
> >df
>
> 48
> 1
> 35
> 32
> 80
>
> If df < 30 then replace it with 30 and else if df > 60 replace it with 60.
> I have a large dataset so
Hi
How can do this in R.
>df
48
1
35
32
80
If df < 30 then replace it with 30 and else if df > 60 replace it with 60. I
have a large dataset so I cant afford to identify indexes and then replace.
Desired o/p:
48
30
3
Christian Schulz wrote:
Hi,
i have list with 2575 cgi files which i have read with readLines - all
Lines have the type "chr".
Now i want replace the 2. line with a condition in 4. line and write
the files back to dir.
How i could avoid the incompatible problem, or is it better
doing somethin
Hi,
i have list with 2575 cgi files which i have read with readLines - all
Lines have the type "chr".
Now i want replace the 2. line with a condition in 4. line and write
the files back to dir.
How i could avoid the incompatible problem, or is it better
doing something with awk!?
for (i in 1
10 matches
Mail list logo