This is a test version of Biostars. For the public version, visit https://www.biostars.org.
how to extract columns from csv using a list of name

I have a list of name, c <- ("a","c","e"), which is a subset of the column names from a matrix(let's say the column names are "a","b","c","d","e","f"). Now I want to use the list of name to extract corresponding columns from this matrix, how should I do this in R.

r excel

Simply use yourmatrix[,your list]

Sorry I do not speak robot

1 answer

I would recommend looking up the select function of the dplyr package, convert your matrix to a data frame first. There are many ways to do this, type your question in to google.

Log in to answer this question.