delete first three lines dataframe R

To delete the first three lines of a dataframe in R, you can follow these steps:

  1. Use indexing: Use the square bracket notation to select the rows you want to keep. In this case, you want to exclude the first three rows, so you can use the index 4:nrow(df) to select all rows starting from the fourth row to the end.
  2. Assign the updated dataframe: Assign the selected rows to the original dataframe to update it. You can do this by using the assignment operator <- and specifying the rows you want to keep, like df <- df[4:nrow(df), ].
  3. Verify the changes: To confirm that the first three lines have been deleted, you can print the dataframe using the print() function or view it in the RStudio viewer pane.

Note: Make sure to replace "df" with the actual name of your dataframe.