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)
1.4m articles
1.4m replys
5 comments
57.0k users