-2

in R programming, how do I subset a matrix so that I can skip columns in between? I only know how to do it continuously such as 1:4, but what if I want the first, second, and fourth colum

LMadden
  • 1
  • 1

1 Answers1

1

You can select specific columns as follows:

new_df <- x[,c(1,2,4)]# Select column 1,2 and 4 
Víctor Cortés
  • 473
  • 4
  • 9