[R] Ifelse statements and combining columns

Kirsten Morehouse kmoreho1 at swarthmore.edu
Mon Jul 24 14:23:57 CEST 2017


Hi everyone,

I'm having some trouble with my ifelse statements.

I'm trying to put 12 conditions within 3 groups. Here is the code I have so
far:

dat$cond <- ifelse(test = dat$cond == "cond1" | dat$cond == "cond2"  |
dat$cond == "cond3" dat$cond == "cond4"
                   yes = "Uniform"
                   no = ifelse(test = dat$cond == "cond5" | dat$cond ==
"cond6") | dat$cond == "cond7" dat$cond == "cond8"
                   yes = "Biased Low"
                   no = "Biased High" )


I keep getting an error statement about an invalid ). I've tried several
permutations to fix, but without luck.

Also, can anyone help me bind columns together? I've tried:

 cbind[, c(15:25)] but get the error:  object of type 'closure' is not
subsettable

Thank you in advance!

Kirsten

	[[alternative HTML version deleted]]



More information about the R-help mailing list