We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 682d129 commit 684c9c4Copy full SHA for 684c9c4
DataFrameManipulation/selecting columns based on string match
@@ -0,0 +1,16 @@
1
+# selecting certain columns that contain a string of characters
2
+# eg I have an OTU table and my sample names correspond to treatment
3
+# and timepoint. I can select all the samples from a certain treatment
4
+
5
+require(dplyr)
6
+# eg my samples names from my controls all contain the prefix "Tmt1" eg Tmt1_t0_repA
7
8
+tmt1 <- select(fullDataSet, starts_with("Tmt1"))
9
10
+# if I wanted to select based on time (which is in the middle of the string then change for 'contains'
11
12
+timeZero <- select(fullDataSet, contains("t0"))
13
14
+# or if i wanted to choose all replicate As from the dataset it would be ends_with()
15
16
+repAs <- select(fullDataSet, ends_with("repA"))
0 commit comments