[R] Set value if else...

2010-10-15 Thread Joel
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 without a loop it would be sweet if it could be done. for example:

Re: [R] Set value if else...

2010-10-15 Thread Joshua Wiley
Dear Joel, On Fri, Oct 15, 2010 at 1:16 AM, Joel joda2...@student.uu.se 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

Re: [R] Set value if else...

2010-10-15 Thread Dimitris Rizopoulos
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

Re: [R] Set value if else...

2010-10-15 Thread Joel
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. __

Re: [R] Set value if else...

2010-10-15 Thread Rubén Roa
original- De: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] En nombre de Joel Enviado el: viernes, 15 de octubre de 2010 10:16 Para: r-help@r-project.org Asunto: [R] Set value if else... Hi I want to set a variable to either 1 or 0 depending on an value