I am working with a large list results.list
that contains 22 tables (23544 obs of 6 variables).
I want to sort each table by a specific column (FDR) False Discovery rate and select the first 100 rows. I can do this manually using my simple R commands.
attach(results.list$adult.OLFvsVTA)
sort(FDR)
detach(results.list$adult.OLFvsVTA)
adult.OLFvsVTA100<-adult.OLFvsVTA[1:100,]
I want to combine the top 100 rows from all 22 tables. I do not want the FDR values in the combined vector but rather I want to combine the top 100 rows by one column named (genes). I would like to automate this process using an apply function. Despite a series of attempts I can not get it to work. I created another vector called r.names
that contains the names of all 22 tables in my list that I was planning to feed into my apply function. I read several apply help pages but I can't get it to work. Any help would be appreciated.