r - Remove rows from a data frame according to a range of row names -
I would like to remove from one of the data. From all the rows, for example, line number 10 and the next 4 rows, i.e. from row 10 to line 14.
The initial line to remove the rows (in this case, the row number 10) is the result of a test, so that I my_test variable briefly my_test The rows should be removed from the variable and 4 rows. I tried:
myfile_cleaned & lt; - my_original_file [-c (test: test +4),] but it does not work. Can somebody help me out?
You can use
myfile_cleaned & lt; - my_original_file [- (Test: (test + 4)),] Due to operator preference of R, : evaluation + . So you need extra brackets.
Comments
Post a Comment