# [R] data summary and some automated t.tests.

stephen sefick ssefick at gmail.com
Fri May 15 17:25:51 CEST 2009

```I would like to preform a t.test to each of the measured variables
(sand.silt etc.) with a mean and sd for each of the treatments (up or
down), and out put this as a table....  I am having a hard time
starting- maybe it is to close to lunch.  Any suggestions would be
greatly appreciated.

Stephen Sefick

x <- (structure(list(sample. = structure(c(1L, 7L, 8L, 9L, 10L, 11L,
12L, 13L, 14L, 2L, 3L, 4L, 5L, 6L, 1L, 7L, 8L, 9L, 10L, 11L,
12L, 13L, 14L, 2L, 3L, 4L, 5L, 6L, 25L, 28L, 29L, 30L, 31L, 32L,
33L, 34L, 35L, 26L, 25L, 28L, 29L, 30L, 31L, 32L, 33L, 34L, 35L,
26L, 27L, 25L, 28L, 29L, 30L, 31L, 32L, 33L, 34L, 35L, 26L, 15L,
17L, 18L, 19L, 20L, 21L, 22L, 23L, 24L, 16L, 15L, 17L, 18L, 19L,
20L, 21L, 22L, 23L, 24L, 16L, 36L, 39L, 40L, 41L, 42L, 43L, 44L,
45L, 46L, 37L, 36L, 39L, 40L, 41L, 42L, 43L, 44L, 45L, 46L, 37L,
38L), .Label = c("0805-r1", "0805-r10", "0805-r11", "0805-r12",
"0805-r13", "0805-r14", "0805-r2", "0805-r3", "0805-r4", "0805-r5",
"0805-r6", "0805-r7", "0805-r8", "0805-r9", "0805-u1", "0805-u10",
"0805-u2", "0805-u3", "0805-u4", "0805-u5", "0805-u6", "0805-u7",
"0805-u8", "0805-u9", "1005-r1", "1005-r10", "1005-r11", "1005-r2",
"1005-r3", "1005-r4", "1005-r5", "1005-r6", "1005-r7", "1005-r8",
"1005-r9", "1005-u1", "1005-u10", "1005-u11", "1005-u2", "1005-u3",
"1005-u4", "1005-u5", "1005-u6", "1005-u7", "1005-u8", "1005-u9"
), class = "factor"), date = structure(c(2L, 2L, 2L, 2L, 2L,
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
2L, 2L, 2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 2L, 2L, 2L, 2L, 2L,
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L), .Label = c("dn", "up"
), class = "factor"), sand.silt = c(20L, 45L, 90L, 21L, 80L,
77L, 30L, 80L, 36L, 9L, 62L, 71L, 20L, 65L, 10L, 70L, 50L, 80L,
90L, 97L, 94L, 82L, 30L, 10L, 65L, 80L, 90L, 70L, 10L, 50L, 60L,
40L, 10L, 45L, 10L, 10L, 15L, 10L, 8L, 35L, 10L, 40L, 10L, 10L,
28L, 5L, 45L, 35L, 2L, 10L, 40L, 2L, 70L, 40L, 20L, 30L, 50L,
60L, 10L, 100L, 98L, 98L, 90L, 87L, 87L, 40L, 97L, 92L, 70L,
50L, 81L, 35L, 70L, 89L, 28L, 28L, 82L, 81L, 33L, 80L, 40L, 40L,
60L, 30L, 5L, 50L, 70L, 75L, 85L, 95L, 93L, 80L, 80L, 60L, 82L,
60L, 5L, 70L, 80L, 40L), gravel = c(8L, 45L, 7L, 5L, 10L, 5L,
35L, 7L, 45L, 60L, 0L, 0L, 5L, 8L, 25L, 0L, 45L, 15L, 0L, 1L,
2L, 5L, 6L, 15L, 10L, 5L, 3L, 10L, 20L, 0L, 20L, 31L, 20L, 35L,
70L, 30L, 60L, 60L, 70L, 50L, 70L, 40L, 50L, 30L, 48L, 85L, 20L,
30L, 20L, 60L, 30L, 8L, 10L, 30L, 30L, 10L, 0L, 0L, 10L, 0L,
0L, 0L, 2L, 8L, 8L, 30L, 0L, 3L, 15L, 29L, 11L, 60L, 15L, 8L,
60L, 25L, 8L, 9L, 42L, 1L, 50L, 40L, 10L, 60L, 60L, 30L, 10L,
10L, 0L, 0L, 0L, 2L, 2L, 0L, 1L, 25L, 10L, 10L, 10L, 50L), cobble = c(5L,
2L, 1L, 5L, 0L, 3L, 10L, 2L, 4L, 3L, 1L, 0L, 3L, 14L, 50L, 0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 0L, 1L, 0L, 0L, 0L, 5L, 0L, 0L, 0L,
10L, 0L, 0L, 2L, 0L, 0L, 0L, 0L, 3L, 0L, 0L, 0L, 0L, 0L, 0L,
0L, 0L, 0L), pool = c(0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L,
6L, 0L, 0L, 0L, 0L, 3L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L,
0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L,
0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L,
0L, 0L, 0L, 0L, 0L, 0L, 0L, 4L, 0L, 0L, 1L, 0L, 0L, 0L, 0L, 0L,
0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L,
0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L)), .Names = c("sample.",
"date", "Replicate", "site", "sand.silt", "gravel", "cobble",
"boulder.bedrock", "fine.root", "course.root", "wood", "leaf",
"leaf.sand", "veg", "pool"), class = "data.frame", row.names = c(NA,
-100L)))

--
Stephen Sefick

Let's not spend our time and resources thinking about things that are
so little or so large that all they really do for us is puff us up and
make us feel like gods.  We are mammals, and have not exhausted the
annoying little problems of being mammals.

-K. Mullis

```