Hi everyone I'm new to R, so this is probably a stupid question, but I looked around for quite a while an couldn't find an answer. Basically I'm trying to print values that correspond to a found maximum.
If I have this: "names" <- c("John", "Jim", "Mary", "Susan") "age" <- c(16, 25, 32, 56) "income" <- c(2000, 3000, 2500, 1500) "all"<- data.frame(names, age, income) max(all$income) I would like to print the name and age that correspond to the found maximum. I tried some if-statements, but they didn't work because my programming skills outside of SQL are basically non-existent. I'd be glad for any pointers, thanks -- View this message in context: http://r.789695.n4.nabble.com/How-to-find-values-that-correspond-to-a-given-value-i-e-max-tp4676456.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ 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.