[Rd] Problematic sentence in Section 6.1 (Lists) of "An introduction to R" (PR#10583)
Full_Name: Michael Höhle Version: 2.7.0 OS: Mac Os X 10.4.11 Submission from: (NULL) (84.153.81.41) Dear R developers, this is not really a bug, but I was confused by the following sentence in Section 6.1 on lists in "An introduction to R" available from e.g. http://cran.r-project.org/doc/manuals/R-intro.html#Lists-and-data-frames Here it says that: Additionally, one can also use the names of the list components in double square brackets, i.e., Lst[["name"]] is the same as Lst$name. ^^^ In the above context this might be right, but if one operates with named lists the $ notation handles abbrevations, whereas the [[]] notation does not. As a consequence I was surprised by the following code: control <- list(nameSpace=1) if (is.null(control$name)) control$name <- TRUE Here control$name is recognized as control$nameSpace and thus control$name is assigned the value TRUE. Had one used control[["name"]] then things would have worked differently. Thus Lst[["name"]] might not be the same as Lst$name. I admit the entire case might be pedantic, but maybe an extra sentence could help. Just a suggestion. __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
[Rd] PR#10583
Thank you for your quick reply and for only indirectly scolding me for abusing the RBugs list. :-) However, I do think there is something funny in the 2.7.0 docu (or in the code). Things behave as expected and explained by you for version 2.6.0/2.6.1, but in the development version 2.7.0 (which I was using) the output is different (see below). The CHANGES file does mention some changes about the [[ subsetting operator, partial matching and exact=TRUE, so I still think the documentation could be clearer at this point by mentioning abbreviations. ###Version 2.6.0 > sessionInfo() R version 2.6.0 Patched (2007-11-12 r43434) i386-apple-darwin8.10.1 locale: C attached base packages: [1] stats graphics grDevices utils datasets methods base > control <- list(nameSpace=FALSE) > control$name [1] FALSE > control[["name"]] [1] FALSE Warning message: In control[["name"]] : partial match of 'name' to 'nameSpace' ###Version 2.7.0 (development) > sessionInfo() R version 2.7.0 Under development (unstable) (2007-12-22 r43762) i386-apple-darwin8.10.1 locale: C attached base packages: [1] stats graphics grDevices utils datasets methods base > control <- list(nameSpace=FALSE) > control$name [1] FALSE > control[["name"]] NULL ^ Anyhow, with your help I found out that what I really wanted was control <- list(nameSpace=FALSE) if (is.null(control[["name",exact=TRUE]])) { control[["name"]] <- TRUE } Thank your for your help and best regards, Michael __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
[Rd] Bug or Feature in Rcmd build workaround workaround for paths in Cygwin tar
To R-devel, I am currently writing a package with R 2.2.1 under Windows using cygwin and the recommended Rtools. Physically my package ist hosted on the Drive z: . When I call Rcmd.exe build –-binary for my package I have a problem with the "build" script in $R_HOME/bin/. Starting on line 226 the code is as follows: if($WINDOWS) { ## workaround for paths in Cygwin tar $filepath =~ s+^([A-Za-x]):+/cygdrive/\1+; } Is there a particular reason that only lower case letter from a-x are handled? As my drive is z: I would like the workaround to work for lower case letters a-z. Best regards, Michael Höhle __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
[Rd] Syntax Error in Rcmd check on Windows
Dear R-developers, I am currently developing an R package called RLadyBug. When developing under Linux "R CMD check ." works fine without a warning. However, when I do "Rcmd check ." under Windows (version 2.4.0 and earlier) I get a „syntax error" when checking the examples. This puzzles me somewhat, because a manual source("RLadyBug-Ex.R") on Windows works fine. On the other hand, a "Rterm.exe --no-save < RLadyBug-Ex.R" in a command shell under Windows reproduces the error. My first guess was that the very long line was causing the problem, but when I open RLadyBug-Ex.R in Emacs, change the coding system from "undecided-dos" to "undecided-unix" and save the file "Rterm.exe --no-save < RLadyBug-Ex.R" works fine Does anybody has an idea what is causing the error and how to fix this? Best regards, Michael Höhle -- --- * checking for working latex ... OK * using log directory 'z:/Transmission/RLadyBug/..Rcheck' * using R version 2.4.0 (2006-10-03) * checking for file './DESCRIPTION' ... OK * checking extension type ... Package * this is package 'RLadyBug' version '0.4-1' * checking package dependencies ... OK * checking if this is a source package ... OK * checking whether package 'RLadyBug' can be installed ... OK * checking package directory ... OK * checking for portable file names ... OK * checking DESCRIPTION meta-information ... OK * checking top-level files ... OK * checking index information ... OK * checking package subdirectories ... OK * checking R files for syntax errors ... OK * checking R files for non-ASCII characters ... OK * checking whether the package can be loaded ... OK * checking whether the package can be loaded with stated dependencies ... OK * checking whether the name space can be loaded with stated dependencies ... OK * checking S3 generic/method consistency ... OK * checking replacement functions ... OK * checking foreign function calls ... OK * checking R code for possible problems ... OK * checking Rd files ... OK * checking Rd cross-references ... OK * checking for missing documentation entries ... OK * checking for code/documentation mismatches ... OK * checking Rd \usage sections ... OK * creating RLadyBug-Ex.R ... OK * checking examples ... ERROR Running examples in 'RLadyBug-Ex.R' failed. The error most likely occurred in: > ### * LBExperiment-class > > flush(stderr()); flush(stdout()) > > ### Name: LBExperiment-class > ### Title: Class "LBExperiment" > ### Aliases: LBExperiment-class show,LBExperiment-method > ### plot,LBExperiment-method plot,LBExperiment,missing-method > ### summary,LBExperiment-method data2events,LBExperiment-method > ### data2events > ### Keywords: classes > > ### ** Examples > > sim.layout <- new( "LBLayout", S0=matrix( c( 13, rep( 14, 7 ) ), ncol=4 ), + E0=matrix( c( 1, rep( 0, 7 ) ), ncol=4 ) ) > sim.opts <- new( "LBOptions", seed=2006, + LBmodel=c( "gamma", "gamma", "gamma", FALSE ), + ignoreData=c( FALSE, FALSE, FALSE ), + initBeta =list( init=0.125, + gamma=0.001, delta=0.001 ), + initBetaN=list( init=0.018, + gamma=0.001, delta=0.001 ), + initIncu=list( asis=FALSE, const=FALSE, + g=6.697, g.gamma=0.001, g.delta=0.001, + d=0.84, d.gamma=0.001,d.delta=0.001 ), + initInf=list( 1.772, 0.001, 0.001, 0.123, 0.001, 0.001 ), + initDia=list( 149.126, 0.001, 0.001, + 8.737, 0.001, 0.001 ) ) Error: syntax error in: "a=list( 149.126, 0.001, 0.001, " 8.737, 0.001, 0.001 ) ) Execution halted __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] Syntax Error in Rcmd check on Windows
Hello again, Thank you for the feedback. I put the source File on the net as http://www.statistik.lmu.de/~hoehle/software/RLadyBug/RLadyBug-Ex.zip In case you need the entire "..Rcheck" directory I put this as http://www.statistik.lmu.de/~hoehle/software/RLadyBug/Rcheck.zip The "(" ")" should balance as it runs through source without problems. I tried to use "hexl-mode" in Emacs to look for funny characters, but didn't find any. If I delete the "initDia" line I just get an syntax error a few lines later... Probably its something very stupid thats wrong, but atm I fail to see it. Best regards, Michael Höhle __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel