Answers for "remove columns and rows in r"

R
3

r remove row dataframe

myData[-c(2, 4, 6), ]   # remove rows 2, 4, 6
Posted by: Guest on July-08-2020
0

remove column from matrix r

# Remove third column - by column number
MyMatrix <- MyMatrix[,-3]

# Remove third and fifth columns - by feeding the matrix a boolean vector
MyMatrix <- MyMatrix[,c(TRUE,TRUE,FALSE,TRUE,FALSE,TRUE)]
Posted by: Guest on August-21-2020

Browse Popular Code Answers by Language