Remove first row from every dataframe in a list


I'm trying to remove the first row for each dataframe in a list. I tried:

N <- length(dfs)
for(i in 1:N){
dfs[[i]] <- dfs[-1,]

But that didn't work (and I didn't really expect it to). Does anyone know of a way to do this?

Thanks so much!

Figured it out. I can just use the lapply function and tail to achieve the result and bypass a loop all together:

dfs <- lapply(dfs, tail, -1)

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.