Greetings,
I am running a buch of wilcox tests and need to be able to rapidly
export the results into a csv file. I have attached example code as well
as my attempts to get what I need. I have tried unlist,cbind,rbind etc
but I am obvously missing something simple. FYI I am actually running
about 50 WRS tests per dataset, this is just an example.

Thanks 10^6
Mike

AKCCR <-
structure(list(ExposureUnit = structure(as.integer(c(1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2)), .Label = c("Reference", "Study"), class =
"factor"),
    Compound.Name = structure(as.integer(c(1, 1, 1, 1, 1, 1,
    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2,
    2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
    2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2)), .Label =
c("Acenaphthene",
    "Cadmium, Total"), class = "factor"), AdjRes = c(0.03, 0.24,
    0.0082, 0.29, 0.01, 0.19, 0.2, 0.22, 0.0032, 0.32, 0.09,
    0.3, 0.0061, 0.0037, 0.38, 0.2, 0.36, 0.09, 0.77, 0.2, 0.19,
    0.2, 0.18, 0.6, 0.32, 0.34, 1.5, 1.2, 0.21, 0.21, 0.01, 0.2,
    0.32, 0.2, 0.19, 0.02, 0.26, 0.37, 0.18, 1.3, 0.0088, 4.78,
    0.0033, 0.32, 2.1, 0.19, 0.01, 0.3, 1.4, 0.21, 0.29, 1.4,
    0.19, 0.21, 0.15, 0.09, 0.16, 0.08, 0.15, 0.17, 0.12, 0.07,
    0.46, 0.13, 0.43, 0.09, 0.26, 1.65, 0.21, 0.28, 0.3, 0.22,
    0.28, 0.19, 0.21, 0.14, 0.17, 0.15, 0.19, 0.16, 2.78, 0.52,
    0.16, 1.35, 0.17, 0.65, 0.17, 0.25, 0.21, 0.17, 0.17, 0.27,
    0.24, 0.19, 0.23, 0.15)), .Names = c("ExposureUnit",
"Compound.Name",
"AdjRes"), class = "data.frame", row.names = c("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"))
attach(AKCCR)
Means <- tapply( AdjRes, list(Compound.Name,ExposureUnit), mean , na.rm
= TRUE)
SdDev <- tapply( AdjRes, list(Compound.Name,ExposureUnit), sd , na.rm =
TRUE)
Samples <- tapply( AdjRes, list(Compound.Name,ExposureUnit), function(x)
sum(!is.na(x)))
#ttest <- by(AKCCR, AKCCR$Compound.Name, function(AKCCR) t.test(AdjRes ~
ExposureUnit, data = AKCCR))
WRS <- by(AKCCR, AKCCR$Compound.Name, function(AKCCR) wilcox.test(AdjRes
~ ExposureUnit, data = AKCCR))
#just one of many attempts to get the output into a form I can write to
a file and import into excel
WRSlist <- cbind(WRS)
WRSFinal <- data.frame(WRSlist)

Michael Bock, PhD.
ENVIRON International Corporation
477 Congress Street, Fifth Floor
Portland, ME 04101
phone: 207.523.3469
fax: 207.773.8597


	[[alternative HTML version deleted]]


