Try col=max.col(data)
This should give you the index of the column with the max value. To get to the final result, combine this with
names(dataframe)[col] to get the name of the column with the maximum value. HTH Jannis AuriDUL schrieb:
Hello. I have data of potatoes production in EU during 1998-2009 from EuroStat where the first column consists of the names of EU countries, the following columns consists of appropriate data in each year. Let's say, I investigate Lithuania. For example, I have a row containing potatoes production in 1998, 1999, ..., 2009 in Lithuania. I can easily find the maximum value in this row but... ...but How could I print the year (the name of the column) where that maximum value of potaoes production in Lithuania exists? [if it's even possible.] I only have a code which can print a number of the column where that maximum value of Lithuania's potatoes production during 1998-2009 is. Thanks in advance.
______________________________________________ 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.