x <- data.frame(x=1:10)
require(gtools)
x$y <- ifelse(odd(x$x),0,1)
HTH
R.
Dr. Rubén Roa-Ureta
AZTI - Tecnalia / Marine Research Unit
Txatxarramendi Ugartea z/g
48395 Sukarrieta (Bizkaia)
SPAIN
> -Mensaj
Indeed I was close :)
Thx for the fast respond!
Have a good day
//Joel
--
View this message in context:
http://r.789695.n4.nabble.com/Set-value-if-else-tp2996667p2996682.html
Sent from the R help mailing list archive at Nabble.com.
__
R-help@r-proj
try this:
table$VoteRight <- as.numeric(table$age > 18)
Best,
Dimitris
On 10/15/2010 10:16 AM, Joel wrote:
Hi
I want to set a variable to either 1 or 0 depending on an value of a
dataframe and then add this as a colum to the dataframe.
This could be done with a loop but as we are able to
Dear Joel,
On Fri, Oct 15, 2010 at 1:16 AM, Joel wrote:
>
> Hi
>
> I want to set a variable to either 1 or 0 depending on an value of a
> dataframe and then add this as a colum to the dataframe.
>
> This could be done with a loop but as we are able to do questions on a
> complete row or colum wit
4 matches
Mail list logo