I have a list of 18 dataframes all looking something akin to this:
Gene ID HMMER Hotpep DIAMOND #ofTools
actino_5_2__00070 GT20(2-473) GT20(5) GT20 3
actino_5_2__00270 CE1(65-331) - - 1
actino_5_2__00610 GT4(224-382) GT4(7) GT4 3
actino_5_2__00950 GH3(26-242) GH3(2) GH3 3
actino_5_2__01300 GH23(67-175) - - 1
actino_5_2__01490 GT4(381-524) GT4(82) GT4 3
actino_5_2__01990 CE1(114-349) - - 1
I want to filter each dataframe in the list but the value of the last column being >= 2. So pretty much this filt_comb_data = comb_data[comb_data$X >= 2,]
but for a list. I started by using lapply with the following:
filt_datalist = lapply(datalist, function(x){
x[x[5],] >= 2
})
But I get this error:
Error in `[.default`(xj, i) : invalid subscript type 'list'
Any help would be appriciated.