Dear R helpers Suppose
val1 = c(10, 20, 35, 80, 12) val2 = c(3, 8, 11, 7) I want to select either val1 or val2 depending on value of third quantity val3. val3 assumes either of the values "Monthly" or "Yearly". If val3 = "Monthly", then val = val1 and if val3 = "Yearly", then val = val2. I tried the ifelse statement as ifelse(val3 = "Monthly", val = val1, val2) I get following error > ifelse(val3 = "Monthly", val = val1, val2) Error in ifelse(val3 = "Monthly", val = val1, val2) : unused argument(s) (val3 = "Monthly", val = val1) > val Error: object 'val' not found Kindly guide. Regards Vincy [[alternative HTML version deleted]]
______________________________________________ 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.