To select all the 'ol' except the last 2 in a data frame, you can use the slice()
function. Combine it with n()
which provides the number of rows of the data frame and pass a sequence of the number of rows you'd like to keep. Here's an example using the dplyr
package:
main.r44 chars5 lines
This will select all rows from df
except the last two.
gistlibby LogSnag