Timeline for Extract or subset hundreds of columns from a data frame
Current License: CC BY-SA 4.0
3 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Apr 8, 2019 at 12:45 | comment | added | Jerb | No probs. You could subset cols with an %in% expression thus: mydata[, cols[cols %in% names(mydata)]] | |
Apr 8, 2019 at 11:59 | comment | added | julie |
Thank you, Jerb, that worked! However, I get this error if there is a gene in my cols list that is not found in the dataset. Error in [.data.frame (sensory, , cols) : undefined columns selected Do you know what I could add to the script to make it skip over any genes it does not find?
|
|
Apr 5, 2019 at 9:27 | history | answered | Jerb | CC BY-SA 4.0 |