I have a list of data frames in R. They are created using lapply and read.csv commands. I want to know the number of rows of each data frame in the list. The nrow command does not work for this list. I am not sure may because it is a list. Any idea about counting the number of rows of each data frame in a list?
Lists don't have rows. Use sapply
to loop over the list:
sapply(data.frame.list, nrow)
or lapply- the difference is in the output
lapply(data.frame.list, function(x) nrow(x))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With