Hi all
I have multiple csv files stored in a list (list.data) having same column names but different data frame names. I would like to subset a column (CHR) by a specific value (1) and apply it to all the data frames in the list and to all the columns.
I wrote this code :
CHR1<-lapply(list.data, function(x) { x["CHR"] = 1; x }
However this seem to subset correctly that specific column (CHR) but the other columns did not change, subset was not applied to the rest of the columns.
I wrote also this code but it returns an empty list
CHR1<-lapply(list.data, subset, "CHR"=1)
Any help highly appreciated. Thanks
Thank you very much for your help once again. It worked. And thanks for the explanation.