Re: [Rd] Revision of shell.exec?
On Wed, 14 Sep 2011, Simon Urbanek wrote: On Sep 14, 2011, at 11:08 AM, Brian Oney wrote: Hi Steve, a quick look at browseURL will tell you that indeed system or shell.exec (on a windows platform) is used to open up a URL. The open part of the proposed function was written to work on a Mac. Because Mac is a unix platform, I assumed that the function open would be omnipresent on unix platforms, my mistake. Well, the problem is that open is unfortunately mapped to openvt on Linux systems which is a quite obscure anachronism. But since Linux is Linux there is no standard way to open a file, so it doesn't really matter ;) -- xdg-utils come closest to what one may call standard but on many systems they are not installed by default (in fact on none of the Linux machines I have around). For URLs R does the hard work to try to figure out what to do with them (it also does the same for PDFs), but you may end up opening things in a browser although that's not what you had in mind. Well I guess, we know how to make to work on a mac. Yes, open works very well on Macs and is extremely useful (I use it all the time - among other things you can use it with directories to browse them...) - it is still beyond me why other unices don't bother ... They do: as 'open' is already taken, they use xdg-open. I am not at all convinced base R needs any such addition: we manage to open anything R itself needs with the existing code. Cheers, Simon I will make the transition to Linux and get back to this in a while, ok? Cheers, Brian On 9/14/2011 2:50 PM, Stephen Weston wrote: 2011/9/14 Uwe Liggeslig...@statistik.tu-dortmund.de: On 14.09.2011 12:27, Brian Oney wrote: Hi List, I hope this is correct list to propose function extensions, sorry if not. I am preparing for a (hopefully painless) migration to linux. As far as I am aware of, the function shell.exec only comes with the windows version. I think this is a handy little function and would like to see my scripts work when I migrate. May I propose something (like the following)? open.file- function(file) { if(.Platform$OS.type==windows) {shell.exec(file)} else {system(paste(open ,file))} } Or just a small addition to the shell.exec function and no new named function. Hope the idea isn't received as too stupid. What is open supposed to do on a non-Windows machine? I do not have it on the only Linux installation I looked at now, hence we obviously cannot assume it exists on an arbitrary installation. I think the nearest equivalent for those running Gnome or KDE may be xdg-open. So there would probably need to be a new option for specifying the appropriate command. Personally, I am more inclined to use system for executing commands, and browseURL for opening documents. browseURL even uses xdg-open in my R installation on my Linux machine. - Steve Best, Uwe Ligges Cheers, Brian __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel -- Brian D. Ripley, rip...@stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
[Rd] FW: [Q] Package NS Hook Lint NOTE (unanswered)
Still have a question about the following NOTEs appearing on CRAN checks: .onLoad calls: require(methods) Package startup functions should not change the search path. See section ŒGood practice¹ in ?.onAttach. For years, I have had the following in my S4-requiring packages. ##- .onLoad - function(libname, pkgname) { ## In case namespace is loaded (via import) by package that ## doesn't depend on S4 methods and used in a session with ## non-default set of packages require(methods) } It was all based on an explanation Prof. Ripley gave to someone about some package loading corner case (reference lost to history though circa R-2.7 or before). Is it no longer an issue? The 'methods' package is (in all cases) already listed in each package's DESCRIPTION Depends entry. Under normal circumstances, is the require() method in the .onLoad() actually altering the search path (since the 'methods' package was already a dependency)? __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
[Rd] using R as SHELL in gnu make
I am intrigued by the possibility of using R as the SHELL in a (Gnu) makefile (instead of /bin/sh). (c.f. http://www.gnu.org/software/make/manual/make.html#Choosing-the-Shell) Well, rather, I would like the makefile's SHELL to be a command which communicated with an R process. The makefile targets/prerequistes would, as always, be OS files, which would be written/read using standard R file IO. The makefile's recipes would be written in R (instead of the usual shell). The R process would be able to be initiated by `load`ing one or more R datasets, libraries or entire images. The R process would be able to accumulate state as the makefile progressed. The recipe's would be able to refer to that state, allowing conditional execution. The R process would optionally be saved as an image of on job termination/completion. The R process might be managed using the RServe package, and would need to be initiated once only, when the makefile was first invoked. I would appreciate learning if anyone had any success, informative failures, or other lore that may help in (or dissuade me from) embarking on attempt this. Thanks, Malcolm Cook Stowers Institute for Medical Research __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
[Rd] could not find function after import
I am trying to build a package (GWASTools, submitted to Bioconductor) that uses the sandwich package. I have references to sandwich in DESCRIPTION: Imports: methods, DBI, RSQLite, sandwich, survival, DNAcopy and NAMESPACE: import(sandwich) In the code itself is a call to vcovHC: Vhat - vcovHC(mod, type=HC0) I have sandwich version 2.2-7 installed. When I run R CMD check on my package, I get the following error during checking of examples: * using R Under development (unstable) (2011-08-29 r56828) * using platform: x86_64-apple-darwin9.8.0 (64-bit) ... * checking examples ... ERROR ... Error in estfun.glm(x) : could not find function is.zoo Calls: assocTestRegression ... meatHC - rowMeans - is.data.frame - estfun - estfun.glm I import sandwich, sandwich depends on zoo, but a function in zoo cannot be found during execution. I tried to get around this by explicitly including a require statement in assocTestRegression: require(sandwich) The example now runs, but I have a warning in R CMD check: * checking for unstated dependencies in R code ... WARNING ‘library’ or ‘require’ call not declared from: ‘sandwich’ I am not sure why this is a problem, as there is a require statement (for a different package) in another function which does not cause any warnings. Can anyone advise on how to get my package to successfully pass R CMD check? thanks, Stephanie Gogarten Research Scientist, Biostatistics University of Washington __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] could not find function after import
On 11-09-19 4:48 PM, Stephanie M. Gogarten wrote: I am trying to build a package (GWASTools, submitted to Bioconductor) that uses the sandwich package. I have references to sandwich in DESCRIPTION: Imports: methods, DBI, RSQLite, sandwich, survival, DNAcopy and NAMESPACE: import(sandwich) In the code itself is a call to vcovHC: Vhat- vcovHC(mod, type=HC0) I have sandwich version 2.2-7 installed. When I run R CMD check on my package, I get the following error during checking of examples: * using R Under development (unstable) (2011-08-29 r56828) * using platform: x86_64-apple-darwin9.8.0 (64-bit) ... * checking examples ... ERROR ... Error in estfun.glm(x) : could not find function is.zoo Calls: assocTestRegression ... meatHC - rowMeans - is.data.frame - estfun - estfun.glm I import sandwich, sandwich depends on zoo, but a function in zoo cannot be found during execution. I tried to get around this by explicitly including a require statement in assocTestRegression: require(sandwich) The example now runs, but I have a warning in R CMD check: * checking for unstated dependencies in R code ... WARNING ‘library’ or ‘require’ call not declared from: ‘sandwich’ I am not sure why this is a problem, as there is a require statement (for a different package) in another function which does not cause any warnings. Can anyone advise on how to get my package to successfully pass R CMD check? If you said that your package Depends on sandwich, you'd probably pass checks, but this is arguably a bug in the sandwich package. The problem is that since you only import sandwich, it never gets attached. So it never attaches its dependency zoo. It should import zoo (or import the functions in zoo that it uses) to work properly the way you are calling it. You can see the same error as follows: 1. Install sandwich, but don't attach it or zoo. 2. Run example(glm) to create the glm object glm.D93. Try to call sandwich::estfun(glm.D93) You'll get the same error as before because is.zoo() will not be loaded. It's also arguably a design flaw in R. For testing sandwich, zoo would generally end up being attached, because the testing of sandwich would attach it. However, examples like the one above are never tested. Duncan Murdoch __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel