Hi, > An I misunderstanding how to use the ifelse construct? And in that > case, how should I go about doing this in a different way?
The ifelse function only apply to a single test passed as first argument, and the second and third arguments are the value returned, and thus should not be an R instruction like «gc_content <- -gc_content». Maybe you could try the following : dataframe$numdir <- 1 dataframe$numdir[dataframe$dir=="-"] <- -1 d <- dataframe$gc_content * dataframe$numdir HTH, Julien -- Julien Barnier Groupe de recherche sur la socialisation ENS-LSH - Lyon, France ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.