Skip to content
Prev 293688 / 398513 Next

creating a new column assigning values of other columns

Bahhhh -- far too much work to recreate (and I don't think you sent us
the file "act.lig"): here's a much better route:

Go to the step immediately before you're in trouble and use dput() on
your data. R will print out a nice plaintext representation that we
can copy and paste and reproduce *exactly* without having to do all
that you show below.

Incidentally, your warning message suggests you should be using
ifelse() instead of if.

To compare:

x <- seq(-3, 3)
abs.x.wrong <- if(x < 0) -x else x # Warning message gives some hint
abs.x.right <- ifelse(x < 0, -x, x)

Hope this helps,

Michael
On Sat, May 5, 2012 at 5:09 PM, Santiago Guallar <sguallar at yahoo.com> wrote: