0

I have two equal lists of "10" dataframes each (nrows of these 10 dataframes is varying): in one are values ("list.n") and in another corresponding Dates ("list.perc"), each column represents one station (the same stations are in all 10 dataframes of a list); NA values are in the end of columns. I am searching for the maximum value of a given column over a list. Even if I use

 sapply(list.n,FUN=function(x)apply(x,MARGIN=2,
                         FUN=max,na.rm=T,arr.ind=T)),

I obtain a dataframe of maxima for each column but for each object of a list and not of all the list and without the index number (the position). I would like to preserve the index because I want use it for searching exactly the same position in another list of the same length (only values are different). The result may be one value per column across all the list.n. Can someone help me? Thanks a lot!

akrun
  • 874,273
  • 37
  • 540
  • 662
  • Please provide few lines of example dataset and expected result – akrun Jan 20 '15 at 17:42
  • 1
    Welcome to SO. Please read about [how to create a reproducible example](http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) and also the SO guidelines for asking a new question. – Rich Scriven Jan 20 '15 at 17:45
  • You may be looking for `which.max` for the index. `sapply(mylist, function(x) sapply(x, which.max))` – akrun Jan 20 '15 at 17:46

0 Answers0