That ifelse statement is a mess, it is missing brackets, comma separators between arguments and & or | between conditions. The bracket error points towards the invalid bracket you had in the second ifelse since it expects and yes and a no argument alongside conditions.
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")) This should be what you want. cbind is a function, therefor it is not subsettable. if you are passing 2 arguments to cbind then cbind takes the form cbind(c(1:n),c(1:n)) and constructs a matrix of dimension 2 x n. For unequal vectors the shorter vector will be recycled. On 24 July 2017 at 14:23, Kirsten Morehouse <kmore...@swarthmore.edu> wrote: > 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]] > > ______________________________________________ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > 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. > [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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.