On Mar 10, 2011, at 12:54 , Duncan Murdoch wrote:
> On 11-03-10 5:54 AM, Ivan Calandra wrote:
>> Try with double "== "instead:
>> ifelse(val3 == "Monthly", val<- val1, val<- val2)
>
> That might work, but it is not how you should do it. (It should work if val3
> has a single entry, but will do
Thanks a lot for the wonderful guidance.
Regards
Vincy
--- On Thu, 3/10/11, Ivan Calandra wrote:
From: Ivan Calandra
Subject: Re: [R] How to use conditional statement
To: "Duncan Murdoch"
Cc: r-help@r-project.org
Received: Thursday, March 10, 2011, 12:32 PM
Thanks for the comment
Thanks for the comment, I didn't think about this thorougly.
Le 3/10/2011 12:54, Duncan Murdoch a écrit :
On 11-03-10 5:54 AM, Ivan Calandra wrote:
Try with double "== "instead:
ifelse(val3 == "Monthly", val<- val1, val<- val2)
That might work, but it is not how you should do it. (It should
On 11-03-10 5:54 AM, Ivan Calandra wrote:
Try with double "== "instead:
ifelse(val3 == "Monthly", val<- val1, val<- val2)
That might work, but it is not how you should do it. (It should work if
val3 has a single entry, but will do strange things if val3 is a vector:
> val3 <- c("Monthly", "
Try with double "== "instead:
ifelse(val3 == "Monthly", val <- val1, val <- val2)
Single "=" is for setting arguments within a function call. If you want
to test equality, then double "==" is required.
See ?"=="
HTH,
Ivan
Le 3/10/2011 11:45, Vincy Pyne a écrit :
Dear R helpers
Suppose
val1
5 matches
Mail list logo