Dear R People: If I put in:> findPerlError: object 'findPerl' not found But if I use:> gdata:::findPerlfunction (perl, verbose = "FALSE") { errorMsg <- "perl executable not found. Use perl= argument to specify the correct path." if (missing(perl)) { perl = "perl" } perl = Sys.which(perl) if (perl == "" || perl == "perl") stop(errorMsg) if (.Platform$OS == "windows") { if (length(grep("rtools", tolower(perl))) > 0) { perl.ftype <- shell("ftype perl", intern = TRUE) if (length(grep("^perl=", perl.ftype)) > 0) { perl <- sub("^perl=\"([^\"]*)\".*", "\\1", perl.ftype) } } } if (verbose) cat("Using perl at", perl, "\n") perl } <environment: namespace:gdata>>Why does one work but not the other, please? Thanks, Erin -- Erin Hodgess Associate Professor Department of Computer and Mathematical Sciences University of Houston - Downtown mailto: erinm.hodgess at gmail.com
??namespace ?getAnywhere ?"::" See also: http://www.stat.uiowa.edu/~luke/R/namespaces/morenames.pdf Bottom line: namespaces provide a mechanism to "hide" certain variables within a package. Special measures as documented above are required to view them -- Bert On Sun, Dec 4, 2011 at 1:19 PM, Erin Hodgess <erinm.hodgess at gmail.com> wrote:> Dear R People: > > If I put in: > >> findPerl > Error: object 'findPerl' not found > > > But if I use: > >> gdata:::findPerl > function (perl, verbose = "FALSE") > { > ? ?errorMsg <- "perl executable not found. Use perl= argument to > specify the correct path." > ? ?if (missing(perl)) { > ? ? ? ?perl = "perl" > ? ?} > ? ?perl = Sys.which(perl) > ? ?if (perl == "" || perl == "perl") > ? ? ? ?stop(errorMsg) > ? ?if (.Platform$OS == "windows") { > ? ? ? ?if (length(grep("rtools", tolower(perl))) > 0) { > ? ? ? ? ? ?perl.ftype <- shell("ftype perl", intern = TRUE) > ? ? ? ? ? ?if (length(grep("^perl=", perl.ftype)) > 0) { > ? ? ? ? ? ? ? ?perl <- sub("^perl=\"([^\"]*)\".*", "\\1", perl.ftype) > ? ? ? ? ? ?} > ? ? ? ?} > ? ?} > ? ?if (verbose) > ? ? ? ?cat("Using perl at", perl, "\n") > ? ?perl > } > <environment: namespace:gdata> >> > > Why does one work but not the other, please? > > Thanks, > Erin > > -- > Erin Hodgess > Associate Professor > Department of Computer and Mathematical Sciences > University of Houston - Downtown > mailto: erinm.hodgess at gmail.com > > ______________________________________________ > R-help at 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.-- Bert Gunter Genentech Nonclinical Biostatistics Internal Contact Info: Phone: 467-7374 Website: http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm
See end of message. On 05/12/11 10:19, Erin Hodgess wrote:> Dear R People: > > If I put in: > >> findPerl > Error: object 'findPerl' not found > > > But if I use: > >> gdata:::findPerl > function (perl, verbose = "FALSE") > { > errorMsg<- "perl executable not found. Use perl= argument to > specify the correct path." > if (missing(perl)) { > perl = "perl" > } > perl = Sys.which(perl) > if (perl == "" || perl == "perl") > stop(errorMsg) > if (.Platform$OS == "windows") { > if (length(grep("rtools", tolower(perl)))> 0) { > perl.ftype<- shell("ftype perl", intern = TRUE) > if (length(grep("^perl=", perl.ftype))> 0) { > perl<- sub("^perl=\"([^\"]*)\".*", "\\1", perl.ftype) > } > } > } > if (verbose) > cat("Using perl at", perl, "\n") > perl > } > <environment: namespace:gdata> > Why does one work but not the other, please?Because "findPerl" is ``not exported'' from the gdata namespace. Uhhh, what does that mean? I have a vague idea, but I'm not sufficiently confident/competent to elaborate. You'll just have to read up on namespaces. I'm *sure* namespaces are really a Good Thing, but they sure do add to the mysteries of R usage. Has Pat Burns written anything by way of explaining namespace to bunnies like me? cheers, Rolf