Deleting First Row of Data Frame in R Programming
In this R programming tutorial you’ll learn how to delete the first row of a data set.
Creation of Example Data
my_df <- data.frame(x1 = 1:5, # Our example data x2 = LETTERS[1:5]) my_df # Return the example data to console # x1 x2 # 1 1 A # 2 2 B # 3 3 C # 4 4 D # 5 5 E |
my_df <- data.frame(x1 = 1:5, # Our example data x2 = LETTERS[1:5]) my_df # Return the example data to console # x1 x2 # 1 1 A # 2 2 B # 3 3 C # 4 4 D # 5 5 E
Example: Removing First Row of Example Data Frame
my_df[- 1, ] # Deleting first row of data # x1 x2 # 2 2 B # 3 3 C # 4 4 D # 5 5 E |
my_df[- 1, ] # Deleting first row of data # x1 x2 # 2 2 B # 3 3 C # 4 4 D # 5 5 E