-
Notifications
You must be signed in to change notification settings - Fork 8
/
stats.html
88 lines (62 loc) · 2.3 KB
/
stats.html
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
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><title>R: Calculate summary statistics</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="R.css" />
</head><body>
<table width="100%" summary="page for stats {fields}"><tr><td>stats {fields}</td><td style="text-align: right;">R Documentation</td></tr></table>
<h2>
Calculate summary statistics
</h2>
<h3>Description</h3>
<p>Various summary statistics are calculated for different
types of data.
</p>
<h3>Usage</h3>
<pre>
stats(x, by)
</pre>
<h3>Arguments</h3>
<table summary="R argblock">
<tr valign="top"><td><code>x</code></td>
<td>
<p>The data structure to compute the statistics. This can either be a
vector, matrix (data sets are the columns), or a list (data sets are
the components).
</p>
</td></tr>
<tr valign="top"><td><code>by</code></td>
<td>
<p>If x is a vector, an optional vector (either character or numerical)
specifying the categories to divide x into separate data sets.
</p>
</td></tr>
</table>
<h3>Details</h3>
<p>Stats breaks x up into separate data sets and then calls describe
to calculate the statistics.
Statistics are found by columns for matrices, by components for a list and
by the relevent groups when a numeric vector and a by vector are given.
The default set of statistics are the number of
(nonmissing) observations, mean, standard deviation, minimum, lower quartile,
median, upper quartile, maximum, and number of missing observations. If any
data set is nonnumeric, missing values are returned for the statistics.
The by argument is a useful way to calculate statistics on parts of a
data set according to different cases.
</p>
<h3>Value</h3>
<p>A matrix where rows index the summary statistics and the columns
index the separate data sets.
</p>
<h3>See Also</h3>
<p>stats.bin, stats.bplot, describe
</p>
<h3>Examples</h3>
<pre>
#Statistics for 8 normal random samples:
zork<- matrix( rnorm(200), ncol=8)
stats(zork)
zork<- rnorm( 200)
id<- sample( 1:8, 200, replace=TRUE)
stats( zork, by=id)
</pre>
<hr /><div style="text-align: center;">[Package <em>fields</em> version 9.9 <a href="00Index.html">Index</a>]</div>
</body></html>