While I don't particularly like the idea of a package automatically
making changes to the system, you can use
installed.packages()
to see which of your needed packages are already available, and only
install the ones that are missing.
Better would be to put the whole list in Depends, and let R manage the loading.
http://stackoverflow.com/questions/8637993/better-explanation-of-when-to-use-imports-depends
Sarah
On Mon, May 5, 2014 at 9:46 AM, Ashis Deb <ashisdeb83 at gmail.com>
wrote:> Hi all ,
>
> I have a GUI package function like below ,
>
>
> trader<-function()
> {
>
> install.packages("Rgtk2")
> install.packages("cluster")
> install.packages("gWidgets")
> install.packages("gWidgetsRGtk2")
> install.packages("scales")
> install.packages("RGtk2Extras")
> install.packages("FuzzyToolkitUoN")
> install.packages("splines")
> install.packages("plyr")
> install.packages("cairo")
> install.packages("cairoDevices")
> install.packages("e1071")
> install.packages("quantmod")
> install.packages("TTR")
> install.packages("xts")
>
>
> library(RGtk2)
> library(RGtk2Extras)
> library(FuzzyToolkitUoN)
> library(splines)
> library(plyr)
> library(Cairo)
> library(cairoDevice)
> library(gWidgets2)
> library(gWidgetsRGtk2)
> library(e1071)
> library(quantmod)
> library(TTR)
> library(xts)
>
>
>
>
> }
>
>
>
>
>
>
>
> I didn't put the whole code here ,
>
> My problem is I had converted this function into an
> package , it works good ,but every time it has to
> install all the packages , is there something by which only once
> it will install the packages and next time it is not needed .
>
> Thanks
>
> ASHIS
>
---
Sarah Goslee
http://www.functionaldiversity.org