I have a list of data frames. There are 28 data frames in my list. Some of the data frames have empty rows but not all. How can I use lapply
or a similar function to remove empty rows from all data frames in the list?
Here is what I have tried which I modified from this question. Unfortunately, this returned only those rows that were empty.
#Get list of all files that will be analyzed
filenames = list.files(pattern = ".csv")
#read in all files in filenames
mydata_run1 = lapply(filenames, read.csv, header = TRUE, quote = "")
#Remove empty rows
mydata_run1 = lapply(mydata_run1, function(x) sapply(mydata_run1, nrow)>0)
Thank you.