[R] What' wrong?
Song, Guangchun
Guangchun.Song at stjude.org
Thu May 1 21:03:17 CEST 2003
I try to do single proportion test on my category data. Here is my R
script:
library("ctest")
catSignifTest <- function( catFile ) {
###############################################################
## Get the data sets from text file
catData <- read.table( catFile )
ncols <- length(catData)
nrows <- length(catData[,1])
ncol1 <- ncols - 1
probeNbr <- catData[1,]
Achip <- catData[,ncols]
for ( row in 2:nrows ) {
prob <- Achip[ row ] / Achip[ 1 ]
if ( prob <= 0 ) prob <- 0.0000001
if ( prob >= 1 ) prob <- 0.9999999
chip <- catData[row,]
for ( col in 1:ncol1 ) {
succ <- chip[col]
trial <- probeNbr[col]
print ( c(row, col, succ, trial, prob ) )
mytest <- prop.test( succ, trial, prob )
result [ row, col ] = mytest$p.value
}
}
print ( result )
}
Here are the result:
> source("D:/song/R/Test/AML/test_GO_probes.R")
> catSignifTest( 'GOcat.txt')
[[1]]
[1] 2
[[2]]
[1] 1
$V1
[1] 6
$V1
[1] 30
[[5]]
[1] 0.1539431
Error in min(..., na.rm = na.rm) : invalid "mode" of argument
>
Could somebody tell me what's wrong?
Thanks.
Guangchun
More information about the R-help
mailing list