[R] Avoiding car package when loading pkg:doc

David Winsemius dwinsemius at comcast.net
Tue Feb 2 21:31:05 CET 2016


> On Feb 2, 2016, at 10:30 AM, Brian Bolt <brian at mcneilco.com> wrote:
> 
> I am not sure what functions I use in car actually.  I am dependent on the drc package which imports "car".  The main drc function I use is "drm", along with "LL.4"
> 
> https://cran.r-project.org/web/packages/drc/index.html

I think that there are packages that provide tools for examine the potential "flow" of function calls in packages, but I'm not a knowledgeable consumer of such tools. I did just look at the drm.R code and see that the only package that it loads is MASS. I see no packages loaded in the llogistic.R code where LL.4 is defined.

The NAMESPACE file says: importFrom(car, deltaMethod)

You might recompile a source version of drc without those functions and manual pages that require `deltaMethod`. I did that and then removed the 'car' references in ‘DESCRIPTION’, ‘NAMESPACE’.

'drm' seems to be "working" at least to the extent of running the ryegrass example without complaint after removing my old copy and running install.packages on the expanded and edited source:

 install.packages("~/Downloads/drc", repos=NULL, type="source")

#Although the package Description says it needs compilation, I didn't see any C code get compiled when I installed it as source.

### I did get an (unsurprising) warning for my modifications: 

* installing *source* package ‘drc’ ...
files ‘R/ED.lin.R’, ‘man/chickweed.Rd’ are missing
files ‘DESCRIPTION’, ‘NAMESPACE’ have the wrong MD5 checksums

... but the installation proceeded

?ryegrass

## Fitting a four-parameter Weibull model (type 2)
ryegrass.m1 <- drm(rootl ~ conc, data = ryegrass, fct = W2.4())

The `summary` and `plot` calls succeeded.

No warranties on the procedure, and I expect that the more knowledgeable user will find it "dirty" and possibly even dangerous. To make it cleaner, one should probably recompile the package from the system command line before installing

-- 
David.

> 
> 
> 
> Brian Bolt | John McNeil & Co. Inc. | 2223 Avenida de la Playa Suite 204, La Jolla, CA | 707.217.7598
> 
>> On Jan 29, 2016, at 10:14 PM, David Winsemius <dwinsemius at comcast.net> wrote:
>> 
>> 
>>> On Jan 29, 2016, at 10:11 AM, Brian Bolt <brian at mcneilco.com> wrote:
>>> 
>>> I have a non-CRAN package that has a large number of dependencies and as such, the memory footprint from loading my package in R is becoming larger.  I use Rapache often to pre-load my package and provide web services for my code, so the consistent memory footprint is hurting other processes on the machine.
>>> 
>>> I have created an R docker container and when I start R, the memory footprint is 27.89MB, after loading the car package, the memory footprint shoots up to 131.4MB. A difference of 103.51MB.  For comparison, loading ggplot2 only gives a difference of 9.32MB.
>>> 
>>> Is there something I can do, without removing dependencies, that could relieve some of my memory footprint?  To be clear, I am not just asking about the car package but reducing memory dependence in general.  Can I force the R package loader to only load functions from packages that I am dependent on? Is there a way to not load all of the datasets? 
>> 
>> You could be more specific about which functions you need.
>> 
>> 
>>> 
>>> Thanks,
>>> Brian
>>> 
>>> 
>>> 
>>> 	[[alternative HTML version deleted]]
>>> 
>>> ______________________________________________
>>> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
>>> 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.
>> 
>> David Winsemius
>> Alameda, CA, USA
>> 
> 

David Winsemius
Alameda, CA, USA



More information about the R-help mailing list