Home > OS >  How to select columns from dataframe outside of a range?
How to select columns from dataframe outside of a range?

Time:10-11

How can I specify a range of columns plus an additional column that's outside of a range using this type of format/notation?

# this specifies range of columns 2-5
is.na( dataset [,2:5])

# I would like to specify for columns 2-5 and column 12 within a single line like this
is.na( dataset [,2:5 & 12])

CodePudding user response:

Use c to concatenate:

is.na(dataset[, c(2:5, 12)])
  • Related