> > 2 highH
> > 3 highH
> > 4 NeutralN
> > 5 NeutralN
> > 6 Neutral N
> > 7 lowL
> > 8 lowL
> > 9 lowL
> > 10 lowL
> >
> > A.K.
> >
> >
> >
> >
lowL
A.K.
- Original Message -----
From: Sachinthaka Abeywardana
To: r-help@r-project.org
Cc:
Sent: Sunday, August 12, 2012 8:43 PM
Subject: [R] if else elseif for data frames
Hi all,
It seems like I cannot use normal 'if' for data frames. What would be the
best way to do t
ot;low"="L"')
dat2
# col1 col2
#1 high H
#2 Neutral N
#3 Neutral N
#4 low L
#5 high H
#6 low L
#7 low L
#8 Neutral N
#9 Neutral N
#10 high H
A.K.
____________
From: Sachinthaka Abeywardana
To:
_
From: Sachinthaka Abeywardana
To: arun
Cc: R help
Sent: Sunday, August 12, 2012 9:07 PM
Subject: Re: [R] if else elseif for data frames
The thing is I have about 10 cases. I saw the ifelse statement but was
wondering if there was a cleaner method of doing it. The coding will get re
On Sun, Aug 12, 2012 at 8:07 PM, Sachinthaka Abeywardana
wrote:
> The thing is I have about 10 cases. I saw the ifelse statement
Note that there is no "ifelse" statement: there is only nested if/else of forms
if
else if
else if
else
> but was
> wondering if
On Aug 12, 2012, at 5:43 PM, Sachinthaka Abeywardana wrote:
Hi all,
It seems like I cannot use normal 'if' for data frames. What would
be the
best way to do the following.
if data$col1='high'
data$col2='H'
else if data$col1='Neutral'
data$col2='N'
else if data$col='low'
data$col2='
; dat1
>>> col1 col2
>>> 1 highH
>>> 2 highH
>>> 3 highH
>>> 4 NeutralN
>>> 5 NeutralN
>>> 6 NeutralN
>>> 7 lowL
>>> 8 lowL
>>> 9 lowL
>
H
>> 4 NeutralN
>> 5 NeutralN
>> 6 NeutralN
>> 7 low L
>> 8 lowL
>> 9 lowL
>> 10 lowL
>>
>> A.K.
>>
>>
>>
>>
>> - Original Message -
>> From: Sachi
2
1 high H
2 high H
3 high H
4 Neutral N
5 Neutral N
6 Neutral N
7 low L
8 low L
9 low L
10 low L
A.K.
- Original Message -
From: Sachinthaka Abeywardana
To: r-help@r-project.org
Cc:
Sent: Sunday, August 12, 2012 8:43 PM
highH
> 2 highH
> 3 highH
> 4 NeutralN
> 5 NeutralN
> 6 NeutralN
> 7 lowL
> 8 lowL
> 9 lowL
> 10 lowL
>
> A.K.
>
>
>
>
> ----- Original Message -
> From: Sachinthaka Abey
Hi all,
It seems like I cannot use normal 'if' for data frames. What would be the
best way to do the following.
if data$col1='high'
data$col2='H'
else if data$col1='Neutral'
data$col2='N'
else if data$col='low'
data$col2='L'
else
#chuch a warning?
Note that col2 was not an existin
11 matches
Mail list logo