[R] Forking and adapting an R package

timo at timogrossenbacher.ch
Tue, 12 Jul 2016 11:28:45 -0000

Hello.

I'm trying to adapt the package ?hexbin? to suit my needs. This is the first
time I do this. I've read a bit through Hadley's ?R packages?, but now
I'm
pretty lost (from a workflow point of view). I am using RStudio and Hadley's
devtools.

So I forked the repo I want to adapt: https://github.com/grssnbchr/hexbin  and
cloned it using RStudio (I created a new project). What I basically want to do
is adapt the package slightly and use the adapted source on my use case (an Rmd
file in another location) - ideally, I would call the respective function
(hexbin::grid.hexagons) in the Rmd and the source code of ?hexbin? would be
called and debugged (just for understanding what the package ?hexbin? actually
does in that case, I do not have to build it yet, or even publish it). What is
the workflow for this?

Also, I tried running devtools::check() and it already fails there:
R version 3.2.5 (2016-04-14) -- "Very, Very Secure Dishes"

Platform: x86_64-pc-linux-gnu (64-bit)

> devtools::check()
Updating hexbin documentation
Loading hexbin
Creating a generic function for ?plot? from package ?graphics? in package
?hexbin?
Creating a generic function for ?summary? from package ?base? in package
?hexbin?
Setting env vars
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
CFLAGS : -Wall -pedantic
CXXFLAGS: -Wall -pedantic
Building hexbin
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
'/usr/lib/R/bin/R' --no-site-file --no-environ --no-save --no-restore
--quiet
CMD build '/home/tgrossen/R/hexbin' --no-resave-data --no-manual

* checking for file ?/home/tgrossen/R/hexbin/DESCRIPTION? ... OK
* preparing ?hexbin?:
* checking DESCRIPTION meta-information ... OK
* cleaning src
* installing the package to build vignettes
* creating vignettes ... ERROR

Error: processing vignette 'hexagon_binning.Rnw' failed with
diagnostics:
 chunk 1 (label = comphexsq)
Error in eval(expr, envir, enclos) : could not find function ?hexbin?
Execution halted
Error: Command failed (1)

As you can see, I am very much lost. I googled for "adapt R package and
debug"
and so forth but couldn't find any tutorial or anything.

Thanks,

Timo