user12310746
user12310746

Reputation: 279

Subsetting data frame but skipping some rows

I have a data frame with 491 observations, and I'm trying to subset rows 1 to 123 and rows 259 to 367. Is there an operator I can use to indicate that?

Upvotes: 1

Views: 94

Answers (1)

akrun
akrun

Reputation: 886938

We can use row indexing by concatenating the sequence of values from 1 to 123 and 259 to 367

df2 <- df1[c(1:123, 259:367),]

Upvotes: 1

Related Questions