[Rd] Reference Classes, Generator Object
Hello, I am working with a reference class: Foo - setRefClass(Bar, fields = list( a = numeric), methods = list( baz = function( xa ) a - xa ) ) x - Foo$new() x$baz(2) x$a y - new(Bar) y$baz(4) y$a But that might be confusing, since new(Foo) does not work and neither does Bar$new() (which is both clear to me but -- maybe -- not to the user). So my idea was to: Bar - setRefClass(Bar, fields = list( a = numeric), methods = list( baz = function( xa ) a - xa ) ) x - Bar$new() x$baz(2) x$a y - new(Bar) y$baz(4) y$a However, this is not the way it is usually done (e.g., with Rcpp modules), why not? Thanks, Sören __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
[Rd] Require of gWidgetsRGtk2 fails: RGtk2.dll can't be found, but it's there
Dear list, I've been trying to get gWidgets/gWidgetsRGtk2 to run every other month for a while, but somehow I simply can't figure out what's going wrong. I tried several distributions of the GTK runtime environment for Windows (http://downloads.sourceforge.net/gladewin32/gtk-2.12.9-win32-1.exe as described in the package's vignette, http://ftp.gnome.org/pub/gnome/binaries/win32/gtk+/2.22/gtk+-bundle_2.22.1-20101227_win32.zip) I also included GTK in my Windows PATH. Yet, when I run 'require(gWidgetsRGtk2)', R complains that the RGtk2.dll can't be found/loaded (see below). But this file definitely exists. I'm running R-2.13.0 from a USB Device but made sure that args 'destdir' and 'lib' are set propperly in 'install.packages'. Loading required package: gWidgetsRGtk2 Loading required package: gWidgets Error in inDL(x, as.logical(local), as.logical(now), ...) : unable to load shared object 'R:/Apps/R/R-2.13.0/library/RGtk2/libs/i386/RGtk2.dll': LoadLibrary failure: Das angegebene Modul wurde nicht gefunden. Failed to load RGtk2 dynamic library, attempting to install it. Learn more about GTK+ at http://www.gtk.org If the package still does not load, please ensure that GTK+ is installed and that it is on your PATH environment variable IN ANY CASE, RESTART R BEFORE TRYING TO LOAD THE PACKAGE AGAIN Error : .onAttach failed in attachNamespace() for 'gWidgetsRGtk2', details: call: .Call(name, ..., PACKAGE = PACKAGE) error: C symbol name S_gtk_icon_factory_new not in DLL for package RGtk2 Best regards, Janko R version 2.13.0 (2011-04-13) Platform: i386-pc-mingw32/i386 (32-bit) locale: [1] LC_COLLATE=German_Germany.1252 LC_CTYPE=German_Germany.1252 [3] LC_MONETARY=German_Germany.1252 LC_NUMERIC=C [5] LC_TIME=German_Germany.1252 attached base packages: [1] stats graphics grDevices utils datasets methods base other attached packages: [1] gWidgets_0.0-44 loaded via a namespace (and not attached): [1] gWidgetsRGtk2_0.0-74 RGtk2_2.20.12tools_2.13.0 __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] Require of gWidgetsRGtk2 fails: RGtk2.dll can't be found, but it's there
On Fri, Jun 10, 2011 at 6:04 AM, Janko Thyson janko.thyson.rst...@googlemail.com wrote: Dear list, I've been trying to get gWidgets/gWidgetsRGtk2 to run every other month for a while, but somehow I simply can't figure out what's going wrong. 1. Use the automatically installed GTk2, not some other version. 2. Note that the automatically installed one will be at ...\GTk2-runtime\bin and that will be put at the *end* of your PATH. Change it so that its at the beginning of your PATH to be sure its not picking up something else. 3. If you are changing the path through the control panel and starting R from the command line note that your new path won't be picked up in old command line sessions so start a new command line session to start R. 4. When you start a new R session double check that the automatically installed ...\GTk2-runtime\bin is at the beginning of your path: strsplit(Sys.getenv(PATH), ;)[[1]] -- Statistics Software Consulting GKX Group, GKX Associates Inc. tel: 1-877-GKX-GROUP email: ggrothendieck at gmail.com __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] Require of gWidgetsRGtk2 fails: RGtk2.dll can't be found, but it's there
On Fri, 10 Jun 2011, Janko Thyson wrote: Dear list, I've been trying to get gWidgets/gWidgetsRGtk2 to run every other month for a while, but somehow I simply can't figure out what's going wrong. Your subject line indicates your confusion. It does not say RGtk2.dll cannot be found (at least, the English version of the message does not say so). What it means is that RGtk2.dll or one of the DLLs it depends on cannot be found. See the instructions at http://cran.r-project.org/bin/windows/contrib/2.13/@ReadMe It is Microsoft's error message, not ours. I tried several distributions of the GTK runtime environment for Windows (http://downloads.sourceforge.net/gladewin32/gtk-2.12.9-win32-1.exe as described in the package's vignette, http://ftp.gnome.org/pub/gnome/binaries/win32/gtk+/2.22/gtk+-bundle_2.22.1-20101227_win32.zip) I also included GTK in my Windows PATH. Yet, when I run 'require(gWidgetsRGtk2)', R complains that the RGtk2.dll can't be found/loaded (see below). But this file definitely exists. I'm running R-2.13.0 from a USB Device but made sure that args 'destdir' and 'lib' are set propperly in 'install.packages'. Loading required package: gWidgetsRGtk2 Loading required package: gWidgets Error in inDL(x, as.logical(local), as.logical(now), ...) : unable to load shared object 'R:/Apps/R/R-2.13.0/library/RGtk2/libs/i386/RGtk2.dll': LoadLibrary failure: Das angegebene Modul wurde nicht gefunden. Failed to load RGtk2 dynamic library, attempting to install it. Learn more about GTK+ at http://www.gtk.org If the package still does not load, please ensure that GTK+ is installed and that it is on your PATH environment variable IN ANY CASE, RESTART R BEFORE TRYING TO LOAD THE PACKAGE AGAIN Error : .onAttach failed in attachNamespace() for 'gWidgetsRGtk2', details: call: .Call(name, ..., PACKAGE = PACKAGE) error: C symbol name S_gtk_icon_factory_new not in DLL for package RGtk2 Best regards, Janko R version 2.13.0 (2011-04-13) Platform: i386-pc-mingw32/i386 (32-bit) locale: [1] LC_COLLATE=German_Germany.1252 LC_CTYPE=German_Germany.1252 [3] LC_MONETARY=German_Germany.1252 LC_NUMERIC=C [5] LC_TIME=German_Germany.1252 attached base packages: [1] stats graphics grDevices utils datasets methods base other attached packages: [1] gWidgets_0.0-44 loaded via a namespace (and not attached): [1] gWidgetsRGtk2_0.0-74 RGtk2_2.20.12tools_2.13.0 __ 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
Re: [Rd] Data package questions
Dear Paul, In process of creating data package from an existing one. The current package has both raw data files and the associated RData objects created from them. Currently, the data subdirectory is 1.5Mb and the extdata is 5.4Mb. Never having created a data package before, how is this best done? Should the data package contain only the raw data, or the RData objects too (tightly coupled)? If the later, what (if anything) is added to the DESCRIPTION meta-information to denote the dependency? Should both packages suggest each other? I have one data set that I ship as a few principal components and reconstruct it by a function. The result is then assigned to the exported variable by delayedAssign. That way, you'd need to ship the raw data only, but can provide a ready-to-use R object as well. For my example data, I don't ship the raw data as it is too big (30 MB toy example is really unpolite on CRAN), but I provide it at r-forge and give the link on the help page and in the vignette. Claudia -- Claudia Beleites Spectroscopy/Imaging Institute of Photonic Technology Albert-Einstein-Str. 9 07745 Jena Germany email: claudia.belei...@ipht-jena.de phone: +49 3641 206-133 fax: +49 2641 206-399 __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] Require of gWidgetsRGtk2 fails: RGtk2.dll can't be found, but it's there
On 10.06.2011 13:00, Gabor Grothendieck wrote: On Fri, Jun 10, 2011 at 6:04 AM, Janko Thyson janko.thyson.rst...@googlemail.com wrote: Dear list, I've been trying to get gWidgets/gWidgetsRGtk2 to run every other month for a while, but somehow I simply can't figure out what's going wrong. 1. Use the automatically installed GTk2, not some other version. Thanks for answering. I didn't even know there GTk2 already ships with R. Prof. Brian Ripley linked me to the readme file with recommendations with respect to an GTK2 distribution to use: What it means is that RGtk2.dll or one of the DLLs it depends on cannot be found. See the instructions at http://cran.r-project.org/bin/windows/contrib/2.13/@ReadMe 2. Note that the automatically installed one will be at ...\GTk2-runtime\bin and that will be put at the *end* of your PATH. Change it so that its at the beginning of your PATH to be sure its not picking up something else. My R distribution does not seem to have such a directory (standard windows R-2.13.0 installer from CRAN) How do I manage to have this ...\GTk2-runtime\bin directory available? Thanks a lot, Janko 3. If you are changing the path through the control panel and starting R from the command line note that your new path won't be picked up in old command line sessions so start a new command line session to start R. 4. When you start a new R session double check that the automatically installed ...\GTk2-runtime\bin is at the beginning of your path: strsplit(Sys.getenv(PATH), ;)[[1]] -- *Janko Thyson* janko.thy...@googlemail.com mailto:janko.thy...@googlemail.com Jesuitenstraße 3 D-85049 Ingolstadt Mobile: +49 (0)176 83294257 This e-mail and any attachment is for authorized use by the intended recipient(s) only. It may contain proprietary material, confidential information and/or be subject to legal privilege. It should not be copied, disclosed to, retained or used by any other party. If you are not an intended recipient then please promptly delete this e-mail and any attachment and all copies and inform the sender. [[alternative HTML version deleted]] __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] Require of gWidgetsRGtk2 fails: RGtk2.dll can't be found, but it's there
It is a Microsoft error message, so your Windows is translating it, not R. It does say 'The specified module' in English Windows, without saying who specified the module (but it does often produce a popup naming the module). I've no better idea what your problem is: the @ReadMe instructions work for me, Uwe on winbuilder and in our teaching lab (and the advice in RGtk2 does not). On Fri, 10 Jun 2011, Janko Thyson wrote: On 10.06.2011 13:18, Prof Brian Ripley wrote: On Fri, 10 Jun 2011, Janko Thyson wrote: Dear list, I've been trying to get gWidgets/gWidgetsRGtk2 to run every other month for a while, but somehow I simply can't figure out what's going wrong. Your subject line indicates your confusion. It does not say RGtk2.dll cannot be found (at least, the English version of the message does not say so). What it means is that RGtk2.dll or one of the DLLs it depends on cannot be found. See the instructions at http://cran.r-project.org/bin/windows/contrib/2.13/@ReadMe It is Microsoft's error message, not ours. Thanks for your answer. I followed the advice in the readme file and installed http://ftp.gnome.org/pub/gnome/binaries/win32/gtk+/2.22/gtk+-bundle_2.22.0-201010 16_win32.zip Previously I made sure that all other previously installed GTK+ runtime environments were removed and that the windows PATH reflects the correct path to the new GTK+ files. I also made sure I started a new R session before trying 'require(gWidgetsRGtk2)' again. Yet, the same error. More precisely, a dialog box pops up asking me to install GTK+ or not. That's what's confusing me as well: the package's recommendation with respect to the version of an GTK+ runtime environment is somewhat out-of-sync with the advice in the readme, even though it the version is fairly recent (2011-04-30) Sorry for the german part in the error message, but I wasn't able to get it all to English (tried language = en in Rconsole file, setting up a Renviron.site with LANGUAGE=en, setting Sys.setenv(LANGUAGE=en) and Sys.setenv(LC_ALL=en) to no avail; not a good R day today ;-)). I freely translated it for you: Loading required package: gWidgetsRGtk2 Loading required package: gWidgets Error in inDL(x, as.logical(local), as.logical(now), ...) : unable to load shared object 'R:/Apps/R/R-2.13.0/library/RGtk2/libs/i386/RGtk2.dll': LoadLibrary failure: the specified module could not be found. Failed to load RGtk2 dynamic library, attempting to install it. Learn more about GTK+ at http://www.gtk.org If the package still does not load, please ensure that GTK+ is installed and that it is on your PATH environment variable IN ANY CASE, RESTART R BEFORE TRYING TO LOAD THE PACKAGE AGAIN Error : .onAttach failed in attachNamespace() for 'gWidgetsRGtk2', details: call: .Call(name, ..., PACKAGE = PACKAGE) error: C symbol name S_gtk_icon_factory_new not in DLL for package RGtk2 Do you have any other idea what I might be doing wrong? Regards, Janko I tried several distributions of the GTK runtime environment for Windows (http://downloads.sourceforge.net/gladewin32/gtk-2.12.9-win32-1.exe as described in the package's vignette,http://ftp.gnome.org/pub/gnome/binaries/win32/gtk+/2.22/gtk+-bundle_2.22.1-20101 227_win32.zip) I also included GTK in my Windows PATH. Yet, when I run 'require(gWidgetsRGtk2)', R complains that the RGtk2.dll can't be found/loaded (see below). But this file definitely exists. I'm running R-2.13.0 from a USB Device but made sure that args 'destdir' and 'lib' are set propperly in 'install.packages'. Loading required package: gWidgetsRGtk2 Loading required package: gWidgets Error in inDL(x, as.logical(local), as.logical(now), ...) : unable to load shared object 'R:/Apps/R/R-2.13.0/library/RGtk2/libs/i386/RGtk2.dll': LoadLibrary failure: Das angegebene Modul wurde nicht gefunden. Failed to load RGtk2 dynamic library, attempting to install it. Learn more about GTK+ at http://www.gtk.org If the package still does not load, please ensure that GTK+ is installed and that it is on your PATH environment variable IN ANY CASE, RESTART R BEFORE TRYING TO LOAD THE PACKAGE AGAIN Error : .onAttach failed in attachNamespace() for 'gWidgetsRGtk2', details: call: .Call(name, ..., PACKAGE = PACKAGE) error: C symbol name S_gtk_icon_factory_new not in DLL for package RGtk2 Best regards, Janko R version 2.13.0 (2011-04-13) Platform: i386-pc-mingw32/i386 (32-bit) locale: [1]
Re: [Rd] Require of gWidgetsRGtk2 fails: RGtk2.dll can't be found, but it's there
On Fri, Jun 10, 2011 at 8:31 AM, Janko Thyson janko.thyson.rst...@googlemail.com wrote: On 10.06.2011 13:00, Gabor Grothendieck wrote: On Fri, Jun 10, 2011 at 6:04 AM, Janko Thyson janko.thyson.rst...@googlemail.com wrote: Dear list, I've been trying to get gWidgets/gWidgetsRGtk2 to run every other month for a while, but somehow I simply can't figure out what's going wrong. 1. Use the automatically installed GTk2, not some other version. Thanks for answering. I didn't even know there GTk2 already ships with R. Prof. Brian Ripley linked me to the readme file with recommendations with respect to an GTK2 distribution to use: What it means is that RGtk2.dll or one of the DLLs it depends on cannot be found. See the instructions at http://cran.r-project.org/bin/windows/contrib/2.13/@ReadMe 2. Note that the automatically installed one will be at ...\GTk2-runtime\bin and that will be put at the *end* of your PATH. Change it so that its at the beginning of your PATH to be sure its not picking up something else. My R distribution does not seem to have such a directory (standard windows R-2.13.0 installer from CRAN) How do I manage to have this ...\GTk2-runtime\bin directory available? #1 is referring to the fact that when you run RGTk2 it will ask you if you want it to install GTk2. Say yes and let it install that version to be sure you are using the right one. If you install it yourself manually instead you could very easily install the wrong version. The only problem with the automatic installation is that it puts the GTk2 dll's at the end of your PATH so you can't be sure that something else on your path (such as graphviz which has its own potentially conflicting dll's) won't interfere. To fix that change the PATH so that GTk2 is at the beginning (or at least before anything else that could interere). Thanks a lot, Janko 3. If you are changing the path through the control panel and starting R from the command line note that your new path won't be picked up in old command line sessions so start a new command line session to start R. 4. When you start a new R session double check that the automatically installed ...\GTk2-runtime\bin is at the beginning of your path: strsplit(Sys.getenv(PATH), ;)[[1]] -- Janko Thyson janko.thy...@googlemail.com Jesuitenstraße 3 D-85049 Ingolstadt Mobile: +49 (0)176 83294257 This e-mail and any attachment is for authorized use by the intended recipient(s) only. It may contain proprietary material, confidential information and/or be subject to legal privilege. It should not be copied, disclosed to, retained or used by any other party. If you are not an intended recipient then please promptly delete this e-mail and any attachment and all copies and inform the sender. -- Statistics Software Consulting GKX Group, GKX Associates Inc. tel: 1-877-GKX-GROUP email: ggrothendieck at gmail.com __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] Require of gWidgetsRGtk2 fails: RGtk2.dll can't be found, but it's there
On 10.06.2011 14:40, Gabor Grothendieck wrote: On Fri, Jun 10, 2011 at 8:31 AM, Janko Thyson janko.thyson.rst...@googlemail.com wrote: On 10.06.2011 13:00, Gabor Grothendieck wrote: On Fri, Jun 10, 2011 at 6:04 AM, Janko Thyson janko.thyson.rst...@googlemail.com wrote: Dear list, I've been trying to get gWidgets/gWidgetsRGtk2 to run every other month for a while, but somehow I simply can't figure out what's going wrong. 1. Use the automatically installed GTk2, not some other version. Thanks for answering. I didn't even know there GTk2 already ships with R. Prof. Brian Ripley linked me to the readme file with recommendations with respect to an GTK2 distribution to use: What it means is that RGtk2.dll or one of the DLLs it depends on cannot be found. See the instructions at http://cran.r-project.org/bin/windows/contrib/2.13/@ReadMe 2. Note that the automatically installed one will be at ...\GTk2-runtime\bin and that will be put at the *end* of your PATH. Change it so that its at the beginning of your PATH to be sure its not picking up something else. My R distribution does not seem to have such a directory (standard windows R-2.13.0 installer from CRAN) How do I manage to have this ...\GTk2-runtime\bin directory available? #1 is referring to the fact that when you run RGTk2 it will ask you if you want it to install GTk2. Say yes and let it install that version to be sure you are using the right one. If you install it yourself manually instead you could very easily install the wrong version. The only problem with the automatic installation is that it puts the GTk2 dll's at the end of your PATH so you can't be sure that something else on your path (such as graphviz which has its own potentially conflicting dll's) won't interfere. To fix that change the PATH so that GTk2 is at the beginning (or at least before anything else that could interere). Hm, I did install GTK2 via the automatic installation now (choosing to put the DLLs in the /bin directory). The problem is, that R keeps asking me to repeat this step (the dialog box) every time I try to load (in new R sessions) either RGTk2 or gWidgetsRGtk2 displaying the same error: Loading required package: gWidgetsRGtk2 Loading required package: gWidgets Error in inDL(x, as.logical(local), as.logical(now), ...) : unable to load shared object 'R:/Apps/R/R-2.13.0/library/RGtk2/libs/i386/RGtk2.dll': LoadLibrary failure: The specified module could not be found. Failed to load RGtk2 dynamic library, attempting to install it. Learn more about GTK+ at http://www.gtk.org If the package still does not load, please ensure that GTK+ is installed and that it is on your PATH environment variable IN ANY CASE, RESTART R BEFORE TRYING TO LOAD THE PACKAGE AGAIN Error : .onAttach failed in attachNamespace() for 'gWidgetsRGtk2', details: call: .Call(name, ..., PACKAGE = PACKAGE) error: C symbol name S_gtk_icon_factory_new not in DLL for package RGtk2 I also tried it on a different machine running Windows 7 and R-2.13.0. :-/ Do you have any other idea? Thanks a lot, Janko Thanks a lot, Janko 3. If you are changing the path through the control panel and starting R from the command line note that your new path won't be picked up in old command line sessions so start a new command line session to start R. 4. When you start a new R session double check that the automatically installed ...\GTk2-runtime\bin is at the beginning of your path: strsplit(Sys.getenv(PATH), ;)[[1]] -- Janko Thyson janko.thy...@googlemail.com Jesuitenstraße 3 D-85049 Ingolstadt Mobile: +49 (0)176 83294257 This e-mail and any attachment is for authorized use by the intended recipient(s) only. It may contain proprietary material, confidential information and/or be subject to legal privilege. It should not be copied, disclosed to, retained or used by any other party. If you are not an intended recipient then please promptly delete this e-mail and any attachment and all copies and inform the sender. __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
[Rd] How to add a welcome message in Package development?
Dear all, it is my first post in R-devel list, and hope that this is the right place to ask question related to package development. I have created my first package in Windows through the usual route. Now I want to add some ***Welcome message*** as soon as user loads my package into their R console, using library() function. However I could not figure out where and how should I add this functionality in entire package development procedure, and the Writing R Exts document also seem to be mum on this issue. Can somebody help me how to add this functionality in the development route of package. I believe this is possible as in many existing packages that functionality is present. Thanks, __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] How to add a welcome message in Package development?
On Jun 10, 2011, at 2:54 PM, Nipesh Bajaj wrote: Dear all, it is my first post in R-devel list, and hope that this is the right place to ask question related to package development. I have created my first package in Windows through the usual route. Now I want to add some ***Welcome message*** as soon as user loads my package into their R console, using library() function. However I could not figure out where and how should I add this functionality in entire package development procedure, and the Writing R Exts document also seem to be mum on this issue. Personally, I find welcome messages extremely annoying, because if you load a dependency chain of 20 packages and each has something silly to say, you get pages of completely useless output (since you can't read all of them anyway) that tend to interfere with automated scripts. Also anything people tend to say in those is pertinent only once (when the user first sees the message) so the message is pointless most of the time that it's shown. But that's just my opinion. That said, you can simply use cat() in .First.lib (if your packages has no namespace) or .onAttach or .onLoad (if your packages has a namespace). Cheers, Simon Can somebody help me how to add this functionality in the development route of package. I believe this is possible as in many existing packages that functionality is present. Thanks, __ 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
Re: [Rd] How to add a welcome message in Package development?
On 10 June 2011 at 15:10, Simon Urbanek wrote: | | On Jun 10, 2011, at 2:54 PM, Nipesh Bajaj wrote: | | Dear all, it is my first post in R-devel list, and hope that this is | the right place to ask question related to package development. | | I have created my first package in Windows through the usual route. | Now I want to add some ***Welcome message*** as soon as user loads my | package into their R console, using library() function. However I | could not figure out where and how should I add this functionality in | entire package development procedure, and the Writing R Exts | document also seem to be mum on this issue. | | | Personally, I find welcome messages extremely annoying, because if you load a dependency chain of 20 packages and each has something silly to say, you get pages of completely useless output (since you can't read all of them anyway) that tend to interfere with automated scripts. Also anything people tend to say in those is pertinent only once (when the user first sees the message) so the message is pointless most of the time that it's shown. But that's just my opinion. | | That said, you can simply use cat() in .First.lib (if your packages has no namespace) or .onAttach or .onLoad (if your packages has a namespace). No, not cat() --- please use packageStartupMessage() as that can actually be suppressed easily. Dirk, who also finds them annoying -- Gauss once played himself in a zero-sum game and won $50. -- #11 at http://www.gaussfacts.com __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] How to add a welcome message in Package development?
I agree with Simon that package startup messages are often annoying and not often helpful. However, I think they should be generated with packageStartupMessage(your message) instead of cat(your message\n) The former may be suppressed by wrapping the call to library() with suppressPackageStartupMessages(), just as messages generated by message(your message) may be suppressed with suppressMessages(). You can suppress cat()'s output with capture.output() but you may throw out things that should be seen. E.g., if a package with a NAMESPACE file contains the following .onXXX functions % more testPkgWithNamespace/R/zzz.R .onAttach - function(...) { cat(message from .onAttach via cat\n) message(message from .onAttach via message) packageStartupMessage(message from .onAttach via packageStartupMessage\n) } .onLoad - function(...) { cat(message from .onLoad via cat\n) message(message from .onLoad via message) packageStartupMessage(message from .onLoad via packageStartupMessage\n) } we get: library(testPkgWithNamespace, lib.loc=Rlib) message from .onLoad via cat message from .onLoad via message message from .onLoad via packageStartupMessage message from .onAttach via cat message from .onAttach via message message from .onAttach via packageStartupMessage detach(package:testPkgWithNamespace, unload=TRUE) suppressMessages(library(testPkgWithNamespace, lib.loc=Rlib)) message from .onLoad via cat message from .onAttach via cat detach(package:testPkgWithNamespace, unload=TRUE) suppressPackageStartupMessages(library(testPkgWithNamespace, lib.loc=Rlib)) message from .onLoad via cat message from .onLoad via message message from .onAttach via cat message from .onAttach via message Bill Dunlap Spotfire, TIBCO Software wdunlap tibco.com -Original Message- From: r-devel-boun...@r-project.org [mailto:r-devel-boun...@r-project.org] On Behalf Of Simon Urbanek Sent: Friday, June 10, 2011 12:10 PM To: Nipesh Bajaj Cc: r-devel@r-project.org Subject: Re: [Rd] How to add a welcome message in Package development? On Jun 10, 2011, at 2:54 PM, Nipesh Bajaj wrote: Dear all, it is my first post in R-devel list, and hope that this is the right place to ask question related to package development. I have created my first package in Windows through the usual route. Now I want to add some ***Welcome message*** as soon as user loads my package into their R console, using library() function. However I could not figure out where and how should I add this functionality in entire package development procedure, and the Writing R Exts document also seem to be mum on this issue. Personally, I find welcome messages extremely annoying, because if you load a dependency chain of 20 packages and each has something silly to say, you get pages of completely useless output (since you can't read all of them anyway) that tend to interfere with automated scripts. Also anything people tend to say in those is pertinent only once (when the user first sees the message) so the message is pointless most of the time that it's shown. But that's just my opinion. That said, you can simply use cat() in .First.lib (if your packages has no namespace) or .onAttach or .onLoad (if your packages has a namespace). Cheers, Simon Can somebody help me how to add this functionality in the development route of package. I believe this is possible as in many existing packages that functionality is present. Thanks, __ 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
Re: [Rd] How to add a welcome message in Package development?
On Jun 10, 2011, at 3:36 PM, Dirk Eddelbuettel wrote: On 10 June 2011 at 15:10, Simon Urbanek wrote: | | On Jun 10, 2011, at 2:54 PM, Nipesh Bajaj wrote: | | Dear all, it is my first post in R-devel list, and hope that this is | the right place to ask question related to package development. | | I have created my first package in Windows through the usual route. | Now I want to add some ***Welcome message*** as soon as user loads my | package into their R console, using library() function. However I | could not figure out where and how should I add this functionality in | entire package development procedure, and the Writing R Exts | document also seem to be mum on this issue. | | | Personally, I find welcome messages extremely annoying, because if you load a dependency chain of 20 packages and each has something silly to say, you get pages of completely useless output (since you can't read all of them anyway) that tend to interfere with automated scripts. Also anything people tend to say in those is pertinent only once (when the user first sees the message) so the message is pointless most of the time that it's shown. But that's just my opinion. | | That said, you can simply use cat() in .First.lib (if your packages has no namespace) or .onAttach or .onLoad (if your packages has a namespace). No, not cat() --- please use packageStartupMessage() as that can actually be suppressed easily. Thanks, very, very good point -- that many package authors did not get (I actually checked a few packages before replying and they all use cat() ... eek). Thanks, Simon __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] How to add a welcome message in Package development?
On 10 June 2011 at 16:04, Simon Urbanek wrote: | On Jun 10, 2011, at 3:36 PM, Dirk Eddelbuettel wrote: | | That said, you can simply use cat() in .First.lib (if your packages has no namespace) or .onAttach or .onLoad (if your packages has a namespace). | | No, not cat() --- please use packageStartupMessage() as that can actually | be suppressed easily. | | | Thanks, very, very good point -- that many package authors did not get (I actually checked a few packages before replying and they all use cat() ... eek). Yup :) I have over the years contacted a few fellow package authors to get this changes. Lots to do still. Maybe R CMD check should look into .onLoad() et al? Dirk -- Gauss once played himself in a zero-sum game and won $50. -- #11 at http://www.gaussfacts.com __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
[Rd] CRAN package with dependencies on Bioconductor
Dear all, for a CRAN-package that depends on another Bioconductor-package I find two things annoying and would like to know whether there are some workarounds: 1) Is there some inevitable problem that install.packages does not install uninstalled packages (on which the specified package depends) also from Bioconductor (in the correct version)? 2) In my understanding (please correct me if I'm wrong!) CRAN uses bioconductor packages in another version than biocLite would install. For example: Our package gMCP depends on the package graph that has recently switched to the bioconductor repositories. But even the following commands will fail (i.e. install incompatible versions) for R 2.12 under Windows (and most likely MacOS): source(http://www.bioconductor.org/biocLite.R;) biocLite(graph) install.packages(gMCP) This results in errors like the following: BonferroniHolmGraph(2) Error in validObject(.Object) : invalid class graphMCP object: superclass graphBase not defined in the environment of the object's class The superclass graphBase is introduced in graph 1.30. In my understanding the problem is that our package gMCP is build on CRAN for R 2.12 with the package graph in version 1.30. Unfortunately biocLite installs graph_1.28.0.zip for R 2.12. Are there ways to make dependencies on Bioconductor less complicated? Thanks and best regards, Kornelius [[alternative HTML version deleted]] __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] CRAN package with dependencies on Bioconductor
I'm sorry for sending a wrongly formated mail before. This is the missing text: Dear all, for a CRAN-package that depends on another Bioconductor-package I find two things annoying and would like to know whether there are some workarounds: 1) Is there some inevitable problem that install.packages does not install uninstalled packages (on which the specified package depends) also from Bioconductor (in the correct version)? 2) In my understanding (please correct me if I'm wrong!) CRAN uses bioconductor packages in another version than biocLite would install. For example: Our package gMCP depends on the package graph that has recently switched to the bioconductor repositories. But even the following commands will fail (i.e. install incompatible versions) for R 2.12 under Windows (and most likely MacOS): source(http://www.bioconductor.org/biocLite.R;) biocLite(graph) install.packages(gMCP) This results in errors like the following: BonferroniHolmGraph(2) Error in validObject(.Object) : invalid class graphMCP object: superclass graphBase not defined in the environment of the object's class The superclass graphBase is introduced in graph 1.30. In my understanding the problem is that our package gMCP is build on CRAN for R 2.12 with the package graph in version 1.30. Unfortunately biocLite installs graph_1.28.0.zip for R 2.12. Are there ways to make dependencies on Bioconductor less complicated? Thanks and best regards, Kornelius __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] CRAN package with dependencies on Bioconductor
On 06/10/2011 04:04 PM, Kornelius Rohmeyer wrote: I'm sorry for sending a wrongly formated mail before. This is the missing text: Dear all, for a CRAN-package that depends on another Bioconductor-package I find two things annoying and would like to know whether there are some workarounds: 1) Is there some inevitable problem that install.packages does not install uninstalled packages (on which the specified package depends) also from Bioconductor (in the correct version)? I don't understand what you are asking; a previously installed but then uninstalled package will not influence the ability of R to reinstall it. 2) In my understanding (please correct me if I'm wrong!) CRAN uses bioconductor packages in another version than biocLite would install. For example: Usually, if you setRepositories() and choose BioCsoft, then you will have chosen the correct (i.e., 'same as biocLite') bioc repository for your version of R (this can be scripted by inspecting read.table(file.path(R.home(etc), repositories), header=TRUE, sep=\t) and using appropriate row indexes as the 'ind' argument to setRepositories). Our package gMCP depends on the package graph that has recently switched to the bioconductor repositories. But even the following commands will fail (i.e. install incompatible versions) for R 2.12 under Windows (and most likely MacOS): source(http://www.bioconductor.org/biocLite.R;) biocLite(graph) install.packages(gMCP) This results in errors like the following: BonferroniHolmGraph(2) Error in validObject(.Object) : invalid class graphMCP object: superclass graphBase not defined in the environment of the object's class The superclass graphBase is introduced in graph 1.30. In my understanding the problem is that our package gMCP is build on CRAN for R 2.12 with the package graph in version 1.30. Unfortunately biocLite installs graph_1.28.0.zip for R 2.12. biocLite is returning the correct package -- graph 1.28.0. graph 1.30 did not come in to existence until the most recent release, 2011-04-13, approximately when R-2.13 became the current release version. CRAN is building packages with the current release, R-2.13, for which biocLite and install.packages both (correctly) return graph 1.30. Are there ways to make dependencies on Bioconductor less complicated? Use the current version of R. FWIW, part of the motivation for hosting graph only on Bioconductor (previously it was dual-hosted) is to simplify version problems -- prior to the change, the CRAN version was several releases out of date! Martin Thanks and best regards, Kornelius __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel -- Computational Biology Fred Hutchinson Cancer Research Center 1100 Fairview Ave. N. PO Box 19024 Seattle, WA 98109 Location: M1-B861 Telephone: 206 667-2793 __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] CRAN package with dependencies on Bioconductor
On 11-06-10 7:04 PM, Kornelius Rohmeyer wrote: I'm sorry for sending a wrongly formated mail before. This is the missing text: Dear all, for a CRAN-package that depends on another Bioconductor-package I find two things annoying and would like to know whether there are some workarounds: 1) Is there some inevitable problem that install.packages does not install uninstalled packages (on which the specified package depends) also from Bioconductor (in the correct version)? 2) In my understanding (please correct me if I'm wrong!) CRAN uses bioconductor packages in another version than biocLite would install. For example: Our package gMCP depends on the package graph that has recently switched to the bioconductor repositories. But even the following commands will fail (i.e. install incompatible versions) for R 2.12 under Windows (and most likely MacOS): source(http://www.bioconductor.org/biocLite.R;) biocLite(graph) install.packages(gMCP) This results in errors like the following: BonferroniHolmGraph(2) Error in validObject(.Object) : invalid class graphMCP object: superclass graphBase not defined in the environment of the object's class The superclass graphBase is introduced in graph 1.30. In my understanding the problem is that our package gMCP is build on CRAN for R 2.12 with the package graph in version 1.30. Unfortunately biocLite installs graph_1.28.0.zip for R 2.12. Are there ways to make dependencies on Bioconductor less complicated? Users of your package are likely to have issues; make sure you document that they need to include the Bioconductor repository as well as CRAN. You can specify a version in a dependency (or a version range). I don't know if BioC will make old versions available in binary formats, but they will probably make source versions available. Duncan Murdoch __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] CRAN package with dependencies on Bioconductor
Dear Martin, thanks for your response. The superclass graphBase is introduced in graph 1.30. In my understanding the problem is that our package gMCP is build on CRAN for R 2.12 with the package graph in version 1.30. Unfortunately biocLite installs graph_1.28.0.zip for R 2.12. biocLite is returning the correct package -- graph 1.28.0. graph 1.30 did not come in to existence until the most recent release, 2011-04-13, approximately when R-2.13 became the current release version. CRAN is building packages with the current release, R-2.13, for which biocLite and install.packages both (correctly) return graph 1.30. I doubt this, i.e. CRAN is also still building packages for R 2.12 - and is using graph 1.30 for this as far as I understand it (instead of 1.28). Are there ways to make dependencies on Bioconductor less complicated? Use the current version of R. So you agree that it is impossible to give a reasonable instruction to install such binary packages for older versions of R like the four month old R 2.12? (Reasonable means without manual installation of packages in the correct versions - where the correct versions have to be found out by the maintainer.) Best regards, Kornelius. __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] CRAN package with dependencies on Bioconductor
On 06/10/2011 05:46 PM, Kornelius Rohmeyer wrote: Dear Martin, thanks for your response. The superclass graphBase is introduced in graph 1.30. In my understanding the problem is that our package gMCP is build on CRAN for R 2.12 with the package graph in version 1.30. Unfortunately biocLite installs graph_1.28.0.zip for R 2.12. biocLite is returning the correct package -- graph 1.28.0. graph 1.30 did not come in to existence until the most recent release, 2011-04-13, approximately when R-2.13 became the current release version. CRAN is building packages with the current release, R-2.13, for which biocLite and install.packages both (correctly) return graph 1.30. I doubt this, i.e. CRAN is also still building packages for R 2.12 - and is using graph 1.30 for this as far as I understand it (instead of 1.28). I'm not intimately familiar with CRAN's build system, so perhaps I mis-spoke; Bioconductor packages are versioned in synchrony with R releases. If your package requires graph = 1.30, specify that in the DESCRIPTION. If your users want features introduced when your package requires graph = 1.30, direct them to use R = 2.13. Martin Are there ways to make dependencies on Bioconductor less complicated? Use the current version of R. So you agree that it is impossible to give a reasonable instruction install such binary packages for older versions of R like the four month old R 2.12? (Reasonable means without manual installation of packages in the correct versions - where the correct versions have to be found out by the maintainer.) Best regards, Kornelius. -- Computational Biology Fred Hutchinson Cancer Research Center 1100 Fairview Ave. N. PO Box 19024 Seattle, WA 98109 Location: M1-B861 Telephone: 206 667-2793 __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] CRAN package with dependencies on Bioconductor
2011/6/11 Martin Morgan mtmor...@fhcrc.org: On 06/10/2011 05:46 PM, Kornelius Rohmeyer wrote: Dear Martin, thanks for your response. The superclass graphBase is introduced in graph 1.30. In my understanding the problem is that our package gMCP is build on CRAN for R 2.12 with the package graph in version 1.30. Unfortunately biocLite installs graph_1.28.0.zip for R 2.12. biocLite is returning the correct package -- graph 1.28.0. graph 1.30 did not come in to existence until the most recent release, 2011-04-13, approximately when R-2.13 became the current release version. CRAN is building packages with the current release, R-2.13, for which biocLite and install.packages both (correctly) return graph 1.30. I doubt this, i.e. CRAN is also still building packages for R 2.12 - and is using graph 1.30 for this as far as I understand it (instead of 1.28). I'm not intimately familiar with CRAN's build system, so perhaps I mis-spoke; Bioconductor packages are versioned in synchrony with R releases. If your package requires graph = 1.30, specify that in the DESCRIPTION. If your users want features introduced when your package requires graph = 1.30, direct them to use R = 2.13. I understand this. But my package does not require graph = 1.30. (And if I install the source packages everything is always fine.) The problem is again that R 2.12 installs graph 1.28 but the CRAN packages for R 2.12 are build for graph 1.30. So the default binary packages are incompatible for R 2.12. Best regards, Kornelius. Martin Are there ways to make dependencies on Bioconductor less complicated? Use the current version of R. So you agree that it is impossible to give a reasonable instruction install such binary packages for older versions of R like the four month old R 2.12? (Reasonable means without manual installation of packages in the correct versions - where the correct versions have to be found out by the maintainer.) Best regards, Kornelius. -- Computational Biology Fred Hutchinson Cancer Research Center 1100 Fairview Ave. N. PO Box 19024 Seattle, WA 98109 Location: M1-B861 Telephone: 206 667-2793 __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] CRAN package with dependencies on Bioconductor
2011/6/11 Duncan Murdoch murdoch.dun...@gmail.com: On 11-06-10 7:04 PM, Kornelius Rohmeyer wrote: Dear all, for a CRAN-package that depends on another Bioconductor-package I find two things annoying and would like to know whether there are some workarounds: 1) Is there some inevitable problem that install.packages does not install uninstalled packages (on which the specified package depends) also from Bioconductor (in the correct version)? 2) In my understanding (please correct me if I'm wrong!) CRAN uses bioconductor packages in another version than biocLite would install. For example: Our package gMCP depends on the package graph that has recently switched to the bioconductor repositories. But even the following commands will fail (i.e. install incompatible versions) for R 2.12 under Windows (and most likely MacOS): source(http://www.bioconductor.org/biocLite.R;) biocLite(graph) install.packages(gMCP) This results in errors like the following: BonferroniHolmGraph(2) Error in validObject(.Object) : invalid class graphMCP object: superclass graphBase not defined in the environment of the object's class The superclass graphBase is introduced in graph 1.30. In my understanding the problem is that our package gMCP is build on CRAN for R 2.12 with the package graph in version 1.30. Unfortunately biocLite installs graph_1.28.0.zip for R 2.12. Are there ways to make dependencies on Bioconductor less complicated? Users of your package are likely to have issues; make sure you document that they need to include the Bioconductor repository as well as CRAN. You can specify a version in a dependency (or a version range). I don't know if BioC will make old versions available in binary formats, but they will probably make source versions available. Duncan Murdoch Dear Duncan, the main problem is not addressed by specifying a certain version (or at least I do not see how), since it's not the case that the package requires certain versions. The problem is that the default binary packages of the CRAN package and the Bioconductor package it depends on are incompatible for R 2.12, since CRAN uses a different version of the Bioconductor package for building. (For the source packages of course no problem exists.) Btw. is there a way to find out which versions of the dependent packages were used for building a certain binary package? (I guess in the moment, that CRAN uses always the newest available source packages.) These kind of incompatibilities are extremely hard to track for the package developer. So if there is not a way to install the correct corresponding compatible binary packages from CRAN and Bioconductor, may I suggest that CRAN uses the same versions of dependent Bioconductor packages for the build of binary packages as Bioconductor is providing in binary form by default for the respective R versions? Or am totally on the wrong track? Thank you very much and best regards, Kornelius. __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel