matchcols.html
3.81 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><title>R: Select columns names matching certain critera</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="../../R.css">
</head><body>
<table width="100%" summary="page for matchcols {gdata}"><tr><td>matchcols {gdata}</td><td align="right">R Documentation</td></tr></table>
<h2>Select columns names matching certain critera</h2>
<h3>Description</h3>
<p>
This function allows easy selection of the column names of an object
using a set of inclusion and exclusion critera.
</p>
<h3>Usage</h3>
<pre>
matchcols(object, with, without, method=c("and","or"), ...)
</pre>
<h3>Arguments</h3>
<table summary="R argblock">
<tr valign="top"><td><code>object</code></td>
<td>
Matrix or dataframe</td></tr>
<tr valign="top"><td><code>with, without</code></td>
<td>
Vector of regular expression patterns</td></tr>
<tr valign="top"><td><code>method</code></td>
<td>
One of "and" or "or"</td></tr>
<tr valign="top"><td><code>...</code></td>
<td>
Optional arguments to <code>grep</code></td></tr>
</table>
<h3>Value</h3>
<p>
Vector of column names which match all (<code>method="and"</code>) or any
(<code>method="or"</code>) of the patterns specified in <code>with</code>, but
none of the patterns specified in <code>without</code>.</p>
<h3>Author(s)</h3>
<p>
Gregory R. Warnes <a href="mailto:warnes@bst.rochester.edu">warnes@bst.rochester.edu</a>
</p>
<h3>See Also</h3>
<p>
<code><a href="../../base/html/grep.html">grep</a></code>
</p>
<h3>Examples</h3>
<pre>
# create a matrix with a lot of named columns
x <- matrix( ncol=30, nrow=5 )
colnames(x) <- c("AffyID","Overall Group Means: Control",
"Overall Group Means: Moderate",
"Overall Group Means: Marked",
"Overall Group Means: Severe",
"Overall Group StdDev: Control",
"Overall Group StdDev: Moderate",
"Overall Group StdDev: Marked",
"Overall Group StdDev: Severe",
"Overall Group CV: Control",
"Overall Group CV: Moderate",
"Overall Group CV: Marked",
"Overall Group CV: Severe",
"Overall Model P-value",
"Overall Model: (Intercept): Estimate",
"Overall Model: Moderate: Estimate",
"Overall Model: Marked: Estimate",
"Overall Model: Severe: Estimate",
"Overall Model: (Intercept): Std. Error",
"Overall Model: Moderate: Std. Error",
"Overall Model: Marked: Std. Error",
"Overall Model: Severe: Std. Error",
"Overall Model: (Intercept): t value",
"Overall Model: Moderate: t value",
"Overall Model: Marked: t value",
"Overall Model: Severe: t value",
"Overall Model: (Intercept): Pr(>|t|)",
"Overall Model: Moderate: Pr(>|t|)",
"Overall Model: Marked: Pr(>|t|)",
"Overall Model: Severe: Pr(>|t|)")
# Get the columns which give estimates or p-values
# only for marked and severe groups
matchcols(x, with=c("Pr", "Std. Error"),
without=c("Intercept","Moderate"),
method="or"
)
# Get just the column which give the p-value for the intercept
matchcols(x, with=c("Intercept", "Pr") )
</pre>
<hr><div align="center">[Package <em>gdata</em> version 2.3.1 <a href="00Index.html">Index]</a></div>
</body></html>