Dear David, sorry for the late reply: I didn't notice your message earlier since it ended-up in a different thread.
Thanks for your suggestion: this is actually what I'm currently planning to do, since also my package can work without the GUI. regards, Lorenzo On 20 October 2016 at 15:07, David C Sterratt <david.c.sterr...@ed.ac.uk> wrote: > Dear Lorenzo, > > For my "retistruct" package, which depends on gWidgets2RGtk2, I have > gWidgets2RGtk2, gWidgets2 and cairoDevice as "Suggests" and I put the > following code in the function that opens the GUI ('retistruct()' in > https://github.com/davidcsterratt/retistruct/blob/master/pkg/retistruct/R/ > retistruct-gui.R): > > guiToolkit <- "RGtk2" > require.package <- function(pkg) { > suggests<-tools::package.dependencies(installed.packages()["retistruct",], > depLevel="Suggests")$retistruct > suggests <- suggests[suggests[,1] == pkg] > uptodate <- ifelse(is.na(suggests[2]), > TRUE, > eval(parse(text=paste("packageVersion(suggests[1])", > suggests[2], "suggests[3]")))) > if (!require(pkg, character.only=TRUE) | > !uptodate) { > message(paste("Trying to install required package", pkg)) > install.packages(pkg) > if (!require(pkg, character.only=TRUE)) { > stop(paste("Could not install", pkg)) > } > } > } > require.package(paste0("gWidgets2", guiToolkit)) > require.package("cairoDevice") > options(guiToolkit=guiToolkit) > > > The package can work without a GUI, and may be installed on systems that > do not have GTK installed. There is user documentation on installing > RGtk2 which, if it's useful to you, you could of course copy: > http://retistruct.r-forge.r-project.org/retistruct-user-guide.pdf > > Best wishes, > > David. > > -- > David C Sterratt, Research Fellow - http://homepages.inf.ed.ac.uk/sterratt > Institute for Adaptive and Neural Computation tel: +44 131 651 1739 > School of Informatics, University of Edinburgh fax: +44 131 650 6899 > Informatics Forum, 10 Crichton Street, Edinburgh EH8 9AB, Scotland, UK > > -- > The University of Edinburgh is a charitable body, registered in > Scotland, with registration number SC005336. > > ______________________________________________ > R-package-devel@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-package-devel > [[alternative HTML version deleted]] ______________________________________________ R-package-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-package-devel