[R] My first R-program

Ben Bolker ben at zoo.ufl.edu
Wed Apr 5 21:56:21 CEST 2000


  try
  pValCalculator <- function(b,n=20,m=20) {
    etc...


On Wed, 5 Apr 2000, Shai Shen-Orr wrote:

> Sorry, I pasted the wrong file in earlier... this is the correct one: 
> pValCalculator(b, n=20, m=20)
> {
> 	ind <- 1:min(c(n,m))
> 	prob <- (1-pnorm(b,sd=std*sqrt(ind)))
> 	prob1 <- sum((n-ind+1)*(m-ind+1)*prob)
> 	prob1
> }
> 
> inputData <-
> scan("/users/lvssso/projects/LAMA/output/pValLamaScore.tmp", list(block1
> = "",block2 = "",width1 = 0,width2 = 0,alignment = 0,score = 0));
> 
> 
> pVal <- vector(mode = "numeric", length(inputData$score));
> 
> for(i in 1:length(inputData$score))
> 	pVal[i] <- pValCalculator(inputData$score, inputData$width1,
> inputData$width2);
> 
> inputData$pValue <- list(pVal);
> 
> write.table(inputData, file = "pValLamaScore.out", row.names = FALSE,
> col.names = FALSE, sep = "\t");
> 
> 
> The error seems to be in, in its inability to recognize my self-made
> function (pValCalculator).
> 
> 
> 	Shai
> 
> 

-- 
Ben Bolker                                  bolker at zoo.ufl.edu
Zoology Department, University of Florida   http://www.zoo.ufl.edu/bolker
318 Carr Hall/Box 118525                    tel: (352) 392-5697
Gainesville, FL 32611-8525                  fax: (352) 392-3704

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list