Hi This is probably a question for stack overflow but I am posting it here because there I am not getting much replies, apologies for this.
I have a 24 data frames with different number of rows and with various columns (for instance column SNPs ID and other columns with corresponding values for each SNPs) and I stored those data frames inside a list. I am doing various operations on the data frames at the same time. For instance if I want to order in decreasing manner a column in all the data frames inside the list I do:
myfiles_ordered<-lapply(myfiles, function(x) { x[ order(x$column_name_to_order, decreasing=T),]})
Now, after ordering that column I would like to take the top 5 % of the values of it. I was thinking I can subset all the data frames based on their specific row number multiplied by 0.05 and I wrote something like this:
myfiles_top5<-lapply(myfiles_ordered, function(x) {x[1:nrow(x)*5/100,]})
However, it does not seems to work. Any help highly appreciated, thanks.
Could you add the link to StackOverflow post?
https://stackoverflow.com/questions/53724885/subset-multiple-data-frames-stored-inside-a-list
in any case...this was the link but maybe there I did not explain my problem so well...