Select every nth row from dataframe

For a data frame df, you can get df.new as:

df.new = df[seq(1, nrow(df), 5), ]

This creates an index from row 1 to nrow (number of rows of the table) every 5 rows. You can play with the starting point and the 5 to extract other sequences.

Leave a Comment