How can I delete every n-th row from a dataframe in R?
You could create a function as follows
Nth.delete<-function(dataframe, n)dataframe[-(seq(n,to=nrow(dataframe),by=n)),]
Let's test it out
DF<-data.frame(A=1:15, B=rnorm(15), C=sample(LETTERS,15)) Nth.delete(DF, 3)
2.1m questions
2.1m answers
60 comments
57.0k users