So if I have a vector with a column named "Question" which has two inputs either "no" or "yes" I want to know if there is a way to calculate specific varibles depending on whether questions is either yes or no.
The idea is that I could do:
Question <- c("No","No","Yes","Yes")
if(Question=="yes"){
X <- [1:5]
z <- [2:6]
test1 <- rbind(X,z)
}
if(Question=="no"){
X <- [1:4]
z <- [3:6]
test1 <- rbind(X,z)
}
Right now this is not possible because "Question" is a vector and I was wondering if there is a way to do this besides using ifelse statement.
Aucun commentaire:
Enregistrer un commentaire