I am ashamed to be asking this question, but I couldn't find the solution anywhere. Searching for "if" and "R" is not very productive...
I cannot get a simple if statement to work. I have data on college students. I want to make a string variable that has the names of the years. That is, when the year variable i is equal to 1, I want to have a variable called years equal to "Freshmen". I tried this years <- "Freshmen" if i==1 years <- "Sophomores" if i==2 and so on, but I couldn't get it to work. How can I get this variable to work? Thanks, BQ ______________________________________________ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html