Charilaos Skiadas <[EMAIL PROTECTED]> 
26-03-07 06:04 PM

To
[EMAIL PROTECTED]
cc
<r-help@stat.math.ethz.ch>
Subject
Re: [R] Problem in loading all packages all at once






+++++++++
1000. Now we have to wade through a lot of stuff to get to the point.

@@@ i am really sorry and i also regret to all of the mailing list, i am 
really sorry.
@@@ i just thought that all will be loaded and only when the demand of any 
function
@@@ will come then only it will be loaded in the memory dynamically and 
will be removed 
@@@ after certain amount of time like slab concept in Unix/Linux

2) Perhaps your call to Sys.putenv doesn't do quite what you expect 

@@@ ok got it, but why is it so any links ???

3) I couldn't really see where in your code all these packages are 
+++++++++
@@@actually i was just trying to change R_DEFAULT_PACKAGES by including 
all the packages instead of only the default ones. I thought i will change 
the global variable and it will be having effect all over 'R'. If there 
will be anywere memory overflow then it will warn me. like over buffering 
of the memory

a) At what point in the load process is R_DEFAULT_PACKAGES 
checked? .First.sys doesn't seem to know about it.
@@@ i also had a cursory look at it, and i was also looking at that point 
after which it will not be set by the R itself.

Ok, a bit of search provided an answer to this: Reading the help for 
"options", I see there, in the section about defaultPackages, what is 
probably the most helpful bit (for me) in all this:

defaultPackages:
                 the packages that are attached by default when R starts 
up. 
Initially set from value of the environment variable 
R_DEFAULT_PACKAGES, or if that is unset to c("datasets", "utils", 
"grDevices", "graphics", "stats", "methods"). (Set R_DEFAULT_PACKAGES 
to NULL or a comma-separated list of package names.) A call to 
options should be in your ?.Rprofile? file to ensure that the change 
takes effect before the base package is initialized (see Startup).
@@@ this you can make out from the Rprofile code also that if 
R_DEFAULT_PACKAGES  = NULL
@@@ then it will automatically load all these packages
 
b) What is the format that the R_DEFAULT_PACKAGES variable must have 
(I guess now I know, since it is mentioned in ?options, though that's 
not really the place I would have expected it to be explained) ? The 
only examples I could find on the web were setting it to NULL.

@@@from the usage in Rprofile file it should be a list of packages names
@@@what i feel


Hope all this helps in some way.
@@@it has helped a lot, but question remains how we can have additional 
packages loaded by default ??

Haris Skiadas
Department of Mathematics and Computer Science
Hanover College


On Mar 26, 2007, at 6:01 AM, [EMAIL PROTECTED] wrote:

>
> Hi All
>
> Please see the Rprofile file which i have modified as follows and 
> after
> that when I start R then I see that R says to me "TRUE" for all the
> packages implying that all loaded at once.
> But when i try to use commands as simple as help("lm"), it doesnt 
> work nor
> any of the menu "Packages" is not working.
> Although the regression using lm ( Y ~ X ) is working even summary and
> rnorm is working fine.
> Please tell me why menu and help command is not working
>
> Rprofile is in between +++++++++++++++++++++++++++ lines
> R initialization is in between @@@@@@@@@@@@@@ lines
> Commands are in between $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ lines
>
> Please also suggest me should i send this to r-devel list or not
>
> ### This is the system Rprofile file. It is always run on startup.
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 
> ++++
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 
> ++++
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 
> ++++
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 
> ++++
> options(scipen = 0)
> options(max.print = 10000)# not yet exercised in 'core R'
> options(add.smooth = TRUE)# currently only used in 'plot.lm'
>
> ###################################################################### 
> ########################
> ###################################################################### 
> ########################
> #############code added by gaurav yadav to install many other 
> packages at
> startup#############
> print ("START OF CODE ADDED BY GAURAV YADAV")
> TEMP <- Sys.getenv("R_DEFAULT_PACKAGES")
> print ("R_DEFAULT_PACKAGES")
> print (TEMP)
> print ("=======")
> TEMP <-
> c 
> (TEMP,"aplpack","approximator","apTreeshape","ArDec","arules","ash","a 
> space","assist","aster","asypow","aws","base","bayesm","bayesmix","bay 
> esSurv","BayesTree","BayesValidate","betareg","Bhat","BHH2","bicreduc" 
> ,"biglm","bim","bindata","Biodem","biopara","bitops","bivpois","blight 
> y","blockrand","BMA","boa","Bolstad","boolean","boost","boot","bootstr 
> ap","bqtl","BradleyTerry","brlr","BRugs","BSDA","BsMD","butler","calib 
> rate","calibrator","caMassClass","car","cat","caTools","catspec","cba" 
> ,"cclust","CDNmoney","cfa","CGIwithR","changeLOS","chplot","chron","Ci 
> rcStats","circular","clac","class","classInt","classPP","clim.pact","c 
> limatol","clines","clue","cluster","clusterRepro","clustvarsel","cmprs 
> k","cobs","CoCo","CoCoCg","CoCoCore","CoCoGraph","CoCoObjects","CoCoOl 
> dData","CoCoRaw","cocorresp","coda","coin","colorspace","combinat","co 
> mpositions","concor","concord","cond","conf.design","connectedness","c 
> opula","corpcor","corpora","covRobust","coxrobust","cramer","crossdes" 
> ,"crq","c
>  sampling","cslogistic","CTFS","ctv")
>
[snip]
> #TEMP <- c(TEMP,"runfirst","base","datasets", "utils", "grDevices",
> "graphics","stats","methods","lmtest")
> print ("MODIFIED R_DEFAULT_PACKAGES+++++++++++")
> print (TEMP)
> print ("++++++++++++++++")
> print(Sys.putenv(R_DEFAULT_PACKAGES=TEMP))
> print ("END OF CODE ADDED BY GAURAV YADAV")
>
> ###################################################################### 
> ########################
> ###################################################################### 
> ########################
>
>
> local({dp <- as.vector(Sys.getenv("R_DEFAULT_PACKAGES"))
>        if(identical(dp, "")) # marginally faster to do methods last
>            dp <- c("datasets", "utils", "grDevices", "graphics",
>                    "stats", "methods")
>        else if(identical(dp, "NULL")) dp <- character(0)
>        else dp <- strsplit(dp, ",")[[1]]
>        dp <- sub("[[:blank:]]*([[:alnum:]]+)", "\\1", dp) # strip
> whitespace
>        options(defaultPackages = dp)
>     })
>
> .First.sys <- function()
>
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 
> ++++
>
> THE R SHOWS ME THIS GIVEN HEREIN BELOW WHEN I START R
> @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
> [1] "START OF CODE ADDED BY GAURAV YADAV"
> [1] "R_DEFAULT_PACKAGES+++++++++++"
> R_DEFAULT_PACKAGES
>                 ""
> [1] "++++++++++++++++"
> [1] "MODIFIED R_DEFAULT_PACKAGES+++++++++++"
>   R_DEFAULT_PACKAGES
>                   ""            "aplpack"       "approximator"
>
>
[snip tons of packages]
> [1] "++++++++++++++++"
>   [1] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE
> TRUE TRUE
> [751] TRUE TRUE TRUE TRUE TRUE TRUE TRUE
> [1] "END OF CODE ADDED BY GAURAV YADAV"
>
> R : Copyright 2006, The R Foundation for Statistical Computing
> Version 2.3.0 (2006-04-24)
> ISBN 3-900051-07-0
>
> R is free software and comes with ABSOLUTELY NO WARRANTY.
> You are welcome to redistribute it under certain conditions.
> Type 'license()' or 'licence()' for distribution details.
>
>   Natural language support but running in an English locale
>
> R is a collaborative project with many contributors.
> Type 'contributors()' for more information and
> 'citation()' on how to cite R or R packages in publications.
>
> Type 'demo()' for some demos, 'help()' for on-line help, or
> 'help.start()' for an HTML browser interface to help.
> Type 'q()' to quit R.
>
> [Previously saved workspace restored]
>
>>
>
> @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
>
> $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
>
> Type 'demo()' for some demos, 'help()' for on-line help, or
> 'help.start()' for an HTML browser interface to help.
> Type 'q()' to quit R.
>
> [Previously saved workspace restored]
>
>> help("lm")
> Error: could not find function "help"
>> help.search("regression")
> Error: could not find function "help.search"
>> local({pkg <- select.list(sort(.packages(all.available = TRUE)))
> + if(nchar(pkg)) library(pkg, character.only=TRUE)})
> Error in eval(expr, envir, enclos) : could not find function 
> "select.list"
>> chooseCRANmirror()
> Error: could not find function "chooseCRANmirror"
>> setRepositories()
> Error: could not find function "setRepositories"
>> utils:::menuInstallPkgs()
> --- Please select a CRAN mirror for use in this session ---
> Error in open.connection(file, "r") : unable to open connection
> In addition: Warning message:
> unable to connect to 'cran.r-project.org' on port 80.
> Error in contrib.url(repos, type) : trying to use CRAN without 
> setting a
> mirror
>> update.packages(ask='graphics')
> Error: could not find function "update.packages"
>> utils:::menuInstallLocal()
> Error in install.packages(choose.files("", filters = Filters[c 
> ("zip",  :
>         no packages were specified
>> X<-rnorm(1000)
>> Y<-rnorm(1000)
>> result<-lm(Y ~ X)
>> summary(result)
>
> Call:
> lm(formula = Y ~ X)
>
> Residuals:
>     Min      1Q  Median      3Q     Max
> -3.0047 -0.7205  0.0203  0.7232  3.1052
>
> Coefficients:
>               Estimate Std. Error t value Pr(>|t|)
> (Intercept)  0.0347667  0.0322268   1.079    0.281
> X           -0.0009727  0.0320626  -0.030    0.976
>
> Residual standard error: 1.018 on 998 degrees of freedom
> Multiple R-Squared: 9.223e-07,  Adjusted R-squared: -0.001001
> F-statistic: 0.0009204 on 1 and 998 DF,  p-value: 0.9758
>
>>
>
> $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$





============================================================================================
DISCLAIMER AND CONFIDENTIALITY CAUTION:\ \ This message and ...{{dropped}}

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to