I am using R on a Windows XP professional platform. The following code is part of a bigger one CODE press=function(y,x){ library(qpcR) models.press=numeric(0) cat("\n") dep=y print(dep) indep=log(x) print(indep) yfit=dep-PRESS(lm(dep~indep))[[2]] cat("\n yfit\n") print(yfit) yfit.orig=yfit presid=y-yfit.orig press=sum(presid^2) cat("\n") cat("PRESS =",press,"\n") } On the command R window I define
- Ignored: > x=c(12,24,13,11,23,10,9,17,11,14,18) > y=c(10,11,9,8,5,12,11,21,12,13,14) then I load the press source code, I run it using the x and y values defined before and I get the following > press(x,y) Loading required package: drc Loading required package: alr3 Loading required package: lattice Loading required package: magic Loading required package: abind Loading required package: MASS Loading required package: nlme Loading required package: plotrix 'drc' has been loaded. Please cite R and 'drc' if used for a publication, for references type 'citation()' and 'citation('drc')'. Loading required package: gtools Loading required package: gplots Loading required package: gdata Loading required package: caTools Loading required package: bitops Loading required package: grid Attaching package: 'gplots' The following object(s) are masked from package:plotrix : plotCI The following object(s) are masked from package:stats : lowess 'qpcR' has been loaded. Please cite R and the following if used for a publication: Spiess AN, Feig C, Ritz Highly accurate sigmoidal fitting of real-time PCR data by introducing a parameter for asymmetry. BMC Bioinformatics 2008, 29:221 or Ritz C, Spiess AN. qpcR: an R package for sigmoidal model selection in quantitative real-time polymerase chain reaction analysis. Bioinformatics 2008, 24:1549-1551 Newest version always available at www.dr-spiess.de/qpcR.html. Attaching package: 'qpcR' The following object(s) are masked from package:gplots : residplot [1] 12 24 13 11 23 10 9 17 11 14 18 [1] 2.302585 2.397895 2.197225 2.079442 1.609438 2.484907 2.397895 3.044522 2.484907 2.564949 2.639057 Error in get(noquote(a)) : object 'dep' not found The error reported, as I understand it, is that the object dep it is not defined. Obviously, at least to me, it is defined. If I declare the dep and indep objects on the command R window i. e. > dep=y > indep=x and rerun the programme then it runs correctly and gives > press(x,y) [1] 12 24 13 11 23 10 9 17 11 14 18 [1] 2.302585 2.397895 2.197225 2.079442 1.609438 2.484907 2.397895 3.044522 2.484907 2.564949 2.639057 yfit [1] 13.764062 24.199292 15.804140 15.192045 32.465326 9.547579 9.845243 6.176015 10.521896 12.325493 14.931854 PRESS = 248.7043 Can anybody point out what's the problem? Thanks in advance K. Karakostas ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.