Re: [R-pkg-devel] unexpected CRAN pretest failure

2020-12-17 Thread Joshua Ulrich
On Thu, Dec 17, 2020 at 7:25 AM Rossum, Bart-Jan van
 wrote:
>
> Dear Uwe,
>
> Thanks for your reaction.
> I installed the latest available R-devel version (2020-12-15 r79633) on my 
> own windows pc, but even then the checks pas cleanly.
> So, unfortunately I'm not able to reproduce the issue.
>
> To be sure, I also retried on Winbuilder, which has a slightly different 
> version (r79643), but there the issue is still present.
>
> Could there be something else I need to do to be able to reproduce this 
> locally?
>
I assume you used the pre-compiled version here:
https://cran.r-project.org/bin/windows/base/rdevel.html

That version probably lags behind the subversion repo for about a day.
So you need to build the latest R-devel from the latest source in the
subversion repo. It always has the latest version. Rocker and r-hub
help make this much easier than setting everything up locally on your
machine.

That said, it looks like the pre-compiled version is at r79643 now, so
you should be able to use it to reproduce the issue.

Best,
Josh


> Regards,
> Bart-Jan
>
> -Original Message-
> From: Uwe Ligges 
> Sent: Thursday, December 17, 2020 13:29
> To: Rossum, Bart-Jan van ; 
> r-package-devel@r-project.org
> Subject: Re: [R-pkg-devel] unexpected CRAN pretest failure
>
> This is form a change in R-devel.
> Use a more recent R-devel to reproduce the issue.
>
> Best,
> Uwe Ligges
>
> On 14.12.2020 15:02, Rossum, Bart-Jan van wrote:
> > Dear community,
> >
> > When trying to update my CRAN 
> > (https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fcran.r-project.org%2Fweb%2Fpackages%2FstatgenGxE%2Findex.htmldata=04%7C01%7Cbart-jan.vanrossum%40wur.nl%7C7cee644adb0a4aebb06008d8a28746e3%7C27d137e5761f4dc1af88d26430abb18f%7C0%7C0%7C637438049192516675%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000sdata=XsyDDtwJk%2FXlDxxWxx2ylcx9RX%2BVOb9XWSZruwo42HY%3Dreserved=0)
> >  package in ran into unexpected error on Windows.
> > I had tested before submission on R-hub, which went fine, but CRAN 
> > complained, and this was confirmed on Winbuilder.
> > I noticed a slight difference in R-version used on CRAN/Winbuilder and 
> > R-hub.
> > However, the error itself seems to come from an lme4 function.
> > I'm quite clueless on how to debug/fix this.
> >
> > CRAN and Winbuilder:
> > R Under development (unstable) (2020-12-13 r79623)
> > https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwin-builder.r-project.org%2FnK0OMOQ378SIdata=04%7C01%7Cbart-jan.vanrossum%40wur.nl%7C7cee644adb0a4aebb06008d8a28746e3%7C27d137e5761f4dc1af88d26430abb18f%7C0%7C0%7C637438049192516675%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000sdata=WpzlD%2B7%2BsggCPKJUrjvV4ZchNF12tXAXfrVMjRlh10c%3Dreserved=0
> >
> > R-hub:
> > R Under development (unstable) (2020-11-30 r79529)
> > https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fbuilder.r-hub.io%2Fstatus%2FstatgenGxE_1.0.4.tar.gz-fcc1e205a5fb4fd09559d301ee3502c9data=04%7C01%7Cbart-jan.vanrossum%40wur.nl%7C7cee644adb0a4aebb06008d8a28746e3%7C27d137e5761f4dc1af88d26430abb18f%7C0%7C0%7C637438049192516675%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000sdata=aWev8qrAGU5yO%2FP%2FGqqb3EVqdYYkGq%2FYrUf0b2ZqrDw%3Dreserved=0
> >
> > Any pointers are appreciated,
> > Bart-Jan
> >
> > __
> > R-package-devel@r-project.org mailing list
> > https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fstat.ethz.ch%2Fmailman%2Flistinfo%2Fr-package-develdata=04%7C01%7Cbart-jan.vanrossum%40wur.nl%7C7cee644adb0a4aebb06008d8a28746e3%7C27d137e5761f4dc1af88d26430abb18f%7C0%7C0%7C637438049192516675%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000sdata=VA%2BpMcbmLDsLsjeZj5ucESwPHfgylxG59HHYkr9MOiw%3Dreserved=0
> >
>
> __
> R-package-devel@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-package-devel



--
Joshua Ulrich  |  about.me/joshuaulrich
FOSS Trading  |  www.fosstrading.com

__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel


Re: [R-pkg-devel] How to remove rJava from Ecfun when it's not called directly or indirectly

2020-10-11 Thread Joshua Ulrich
On Sat, Oct 10, 2020 at 10:57 PM Spencer Graves
 wrote:
>
> Hello, All:
>
>
>   "R CMD check Ecfun_0.2-4.tar.gz" fails under Windows 10 with "Error:
> package or namespace load failed for 'Ecfun': .onLoad failed in
> loadNamespace() for 'rJava'".
>
>
>   However, I cannot find where Ecfun calls rJava.  This is in:
>
>
> https://github.com/sbgraves237/Ecfun
>
>
>   I get nothing from "grep 'rJava'" in the DESCRIPTION and NAMESPACE
> files plus in the man and R subdirectories.  I ran
> tools:package_dependencies recursively starting with Ecfun until I got
> all NULLs and could not find rJava anywhere.
>
You need to include suggested package dependencies in your search.

tools::package_dependencies("Ecfun",
  which = c("Depends", "Imports", "LinkingTo", "Suggests"),
  recursive = TRUE)

You will find rJava in that list of ~1650 dependencies.

>
>   Thanks,
>   Spencer Graves
>
>
> 00install.out
>
>
> * installing *source* package 'Ecfun' ...
> ** using staged installation
> ** R
> ** inst
> ** byte-compile and prepare package for lazy loading
> ** help
> *** installing help indices
> ** building package indices
> ** installing vignettes
> ** testing if installed package can be loaded from temporary location
> *** arch - i386
> Error: package or namespace load failed for 'Ecfun':
>   .onLoad failed in loadNamespace() for 'rJava', details:
>call: inDL(x, as.logical(local), as.logical(now), ...)
>error: unable to load shared object 'C:/Program
> Files/R/R-4.0.2/library/rJava/libs/i386/rJava.dll':
>LoadLibrary failure:  %1 is not a valid Win32 application.
>
> Error: loading failed
> Execution halted
> *** arch - x64
> ERROR: loading failed for 'i386'
> * removing 'C:/Users/spenc/Documents/R/Ecfun/Ecfun.Rcheck/Ecfun'
>
>
> 00check.log
>
>
> * using log directory 'C:/Users/spenc/Documents/R/Ecfun/Ecfun.Rcheck'
> * using R version 4.0.2 (2020-06-22)
> * using platform: x86_64-w64-mingw32 (64-bit)
> * using session charset: ISO8859-1
> * checking for file 'Ecfun/DESCRIPTION' ... OK
> * this is package 'Ecfun' version '0.2-4'
> * checking package namespace information ... OK
> * checking package dependencies ... OK
> * checking if this is a source package ... OK
> * checking if there is a namespace ... OK
> * checking for executable files ... OK
> * checking for hidden files and directories ... OK
> * checking for portable file names ... OK
> * checking whether package 'Ecfun' can be installed ... ERROR
> Installation failed.
> See 'C:/Users/spenc/Documents/R/Ecfun/Ecfun.Rcheck/00install.out' for
> details.
> * DONE
> Status: 1 ERROR
>
> __
> R-package-devel@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-package-devel



-- 
Joshua Ulrich  |  about.me/joshuaulrich
FOSS Trading  |  www.fosstrading.com

__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel


Re: [R-pkg-devel] Dependency needs to be loaded manually even its specified in the package

2020-09-18 Thread Joshua Ulrich
On Fri, Sep 18, 2020 at 11:56 AM Dirk Eddelbuettel  wrote:
>
>
> On 18 September 2020 at 18:38, Nuria Perez-Zanon wrote:
> | I am maintaining a package call CSTools which is aimed for
> | post-processing climate simulations.
> [...]
> |  library(CSTools)
> |  library(qmap)
>
> You never use library() in a package. Rather, you declare dependency
> relationsships via DESCRIPTION (and likely NAMESPACE). See "Writing R
> Extensions" for all the details.
>

And here's the relevant section:
https://cran.r-project.org/doc/manuals/r-release/R-exts.html#Registering-S3-methods

Best,
Josh

>
> Dirk
>
> --
> https://dirk.eddelbuettel.com | @eddelbuettel | e...@debian.org
>
> __
> R-package-devel@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-package-devel



-- 
Joshua Ulrich  |  about.me/joshuaulrich
FOSS Trading  |  www.fosstrading.com

__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel


Re: [R-pkg-devel] Use of `:::` in a package for code run in a parallel cluster

2020-09-13 Thread Joshua Ulrich
On Sun, Sep 13, 2020 at 3:19 PM Duncan Murdoch  wrote:
>
> On 13/09/2020 3:51 p.m., David Kepplinger wrote:
> > Dear list members,
> >
> > I submitted an update for my package and got automatically rejected by the
> > incoming checks (as expected from my own checks) for using `:::` calls to
> > access the package's namespace.
> > "There are ::: calls to the package's namespace in its code. A package
> > *almost* never needs to use ::: for its own objects:…" (emphasis mine)
> >
> > This was a conscious decision on my part as the package runs code on a
> > user-supplied parallel cluster and I consider cluster-exporting the
> > required functions a no-go as it would potentially overwrite objects in the
> > clusters R sessions. The package code does not own the cluster and hence
> > the R sessions. Therefore overwriting objects could potentially lead to
> > unintended behaviour which is opaque to the user and difficult to debug.
> >
> > Another solution to circumvent the R CMD check note is to export the
> > functions to the public namespace but mark them as internal. This was also
> > suggested in another thread on this mailing list (c.f. "Etiquette for
> > package submissions that do not automatically pass checks?"). I do not
> > agree with this work-around as the methods are indeed internal and should
> > never be used by users. Exporting truly internal functions for the sake of
> > satisfying R CMD check is a bad argument, in particular if there is a
> > clean, well-documented, solution by using `:::`
>
> Who is calling this function:  package code or user code?  I assume it's
> a bit of a mix:  your package writes a script that calls the function
> when it runs in user space.  (It would help if you gave an explicit
> example of when you need to use this technique.)
>
> If my assumption is correct, there are other simple workarounds besides
> exporting the functions.  Instead of putting
>
> pkg:::foo(args)
>
> into your script, put
>
> pkg::callInternal("foo", args)
>
> where pkg::callInternal is an exported function that can look up
> unexported functions in the namespace.
>
Another possibility is what quantmod::newTA() does.
https://github.com/joshuaulrich/quantmod/blob/a8e9cb87825c0997a8468f5105db6c507b26ac5d/R/newTA.

It's a function that creates a user-facing function.  The created
function needs to access unexported objects from the quantmod
namespace.  newTA() accomplishes that by setting the environment of
the function it returns to the quantmod namespace.

https://github.com/joshuaulrich/quantmod/blob/a8e9cb87825c0997a8468f5105db6c507b26ac5d/R/newTA.R#L98

That gives the user's new function access to the unexported charting
objects it needs to work.

Hope that helps.

Best,
Josh


> You may argue that you prefer pkg:::foo for some reason:  to which I'd
> respond that you are being rude to the CRAN volunteers.  I've offered
> two options (one in the previous thread, a different one here), and
> there was a third one in that thread offered by Ivan Krylov.  Surely one
> of these is good enough for your needs, and you shouldn't force CRAN to
> handle you specially.
>
> Duncan
>
> >
> > I argue `:::` is the only clean solution to this problem and no dirty
> > work-arounds are necessary. This is a prime example of where `:::` is
> > actually useful and needed inside a package. If the R community disagrees,
> > I think R CMD check should at least emit a WARNING instead of a NOTE and
> > elaborate on the problem and accepted work-arounds in "Writing R
> > extensions". Or keep emitting a NOTE but listing those nebulous reasons
> > where `:::` would be tolerated inside a package. Having more transparent
> > criteria for submitting to CRAN would be really helpful to the entire R
> > community and probably also reduce the traffic on this mailing list.
> >
> > Best,
> > David
> >
> >   [[alternative HTML version deleted]]
> >
> > __
> > R-package-devel@r-project.org mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-package-devel
> >
>
> __
> R-package-devel@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-package-devel



--
Joshua Ulrich  |  about.me/joshuaulrich
FOSS Trading  |  www.fosstrading.com

__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel


Re: [R-pkg-devel] CRAN, API packages, Keys and tests

2020-09-04 Thread Joshua Ulrich
On Fri, Sep 4, 2020 at 9:20 AM Joshua Ulrich  wrote:
>
> Hi Rainer,
>
> You could set an environment variable with the API key, and only run
> the tests if the variable is set.
>
Sorry, I missed that you're already doing this.  I confirm that it
works for CRAN.  I also set my API key as a private/secure variable on
TravisCI, so the tests will run there.

IIRC, testthat does something similar. You could look at that pattern,
since it works on CRAN for many packages.

> Here's an example that I use:
> https://github.com/joshuaulrich/quantmod/blob/master/tests/test_getSymbols.R#L4
>
> Best,
> Josh
>
> On Fri, Sep 4, 2020 at 3:25 AM Rainer M Krug  wrote:
> >
> > I know this has been asked a few times - but I can’t find anything which 
> > might help me.
> >
> > I have a package (https://github.com/rkrug/ROriginStamp) which wraps around 
> > API calls to OriginStamp (https://originstamp.com) to obtain trusted time 
> > stamps.
> >
> > The package works, but the tests are the problem on remote machines.
> >
> > My question is:
> >
> > 1) I have disabled all tests and all examples if there is no environmental 
> > variable set with the API Key - is this OK for CRAN?
> > 2) If not, how can I make this CRAN compliant?
> >
> > Thanks,
> >
> > Rainer
> >
> >
> > --
> > Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology, 
> > UCT), Dipl. Phys. (Germany)
> >
> > Orcid ID: -0002-7490-0066
> >
> > Department of Evolutionary Biology and Environmental Studies
> > University of Zürich
> > Office Y34-J-74
> > Winterthurerstrasse 190
> > 8075 Zürich
> > Switzerland
> >
> > Office: +41 (0)44 635 47 64
> > Cell:   +41 (0)78 630 66 57
> > email:  rainer.k...@uzh.ch
> > rai...@krugs.de
> > Skype: RMkrug
> >
> > PGP: 0x0F52F982
> >
> >
> >
> >
> >
> > --
> > Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology, 
> > UCT), Dipl. Phys. (Germany)
> >
> > Orcid ID: -0002-7490-0066
> >
> > Department of Evolutionary Biology and Environmental Studies
> > University of Zürich
> > Office Y34-J-74
> > Winterthurerstrasse 190
> > 8075 Zürich
> > Switzerland
> >
> > Office: +41 (0)44 635 47 64
> > Cell:       +41 (0)78 630 66 57
> > email:  rainer.k...@uzh.ch
> > rai...@krugs.de
> > Skype: RMkrug
> >
> > PGP: 0x0F52F982
> >
> > __
> > R-package-devel@r-project.org mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-package-devel
>
>
>
> --
> Joshua Ulrich  |  about.me/joshuaulrich
> FOSS Trading  |  www.fosstrading.com



-- 
Joshua Ulrich  |  about.me/joshuaulrich
FOSS Trading  |  www.fosstrading.com

__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel


Re: [R-pkg-devel] CRAN, API packages, Keys and tests

2020-09-04 Thread Joshua Ulrich
Hi Rainer,

You could set an environment variable with the API key, and only run
the tests if the variable is set.

Here's an example that I use:
https://github.com/joshuaulrich/quantmod/blob/master/tests/test_getSymbols.R#L4

Best,
Josh

On Fri, Sep 4, 2020 at 3:25 AM Rainer M Krug  wrote:
>
> I know this has been asked a few times - but I can’t find anything which 
> might help me.
>
> I have a package (https://github.com/rkrug/ROriginStamp) which wraps around 
> API calls to OriginStamp (https://originstamp.com) to obtain trusted time 
> stamps.
>
> The package works, but the tests are the problem on remote machines.
>
> My question is:
>
> 1) I have disabled all tests and all examples if there is no environmental 
> variable set with the API Key - is this OK for CRAN?
> 2) If not, how can I make this CRAN compliant?
>
> Thanks,
>
> Rainer
>
>
> --
> Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology, 
> UCT), Dipl. Phys. (Germany)
>
> Orcid ID: -0002-7490-0066
>
> Department of Evolutionary Biology and Environmental Studies
> University of Zürich
> Office Y34-J-74
> Winterthurerstrasse 190
> 8075 Zürich
> Switzerland
>
> Office: +41 (0)44 635 47 64
> Cell:   +41 (0)78 630 66 57
> email:  rainer.k...@uzh.ch
> rai...@krugs.de
> Skype: RMkrug
>
> PGP: 0x0F52F982
>
>
>
>
>
> --
> Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology, 
> UCT), Dipl. Phys. (Germany)
>
> Orcid ID: -0002-7490-0066
>
> Department of Evolutionary Biology and Environmental Studies
> University of Zürich
> Office Y34-J-74
> Winterthurerstrasse 190
> 8075 Zürich
> Switzerland
>
> Office: +41 (0)44 635 47 64
> Cell:   +41 (0)78 630 66 57
> email:  rainer.k...@uzh.ch
> rai...@krugs.de
> Skype: RMkrug
>
> PGP: 0x0F52F982
>
> __
> R-package-devel@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-package-devel



-- 
Joshua Ulrich  |  about.me/joshuaulrich
FOSS Trading  |  www.fosstrading.com

__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel


Re: [R-pkg-devel] visible binding for '<<-' assignment

2020-09-03 Thread Joshua Ulrich
On Thu, Sep 3, 2020 at 4:36 PM Ben Bolker  wrote:
>
>   Is there a reason that this slightly more explicit version wouldn't work?
>
> pali_string_fix <- function() {
>  assign("pali_alphabet", stringi::stri_unescape_unicode(pali_alphabet),
> .GlobalEnv)
> }
>
Using assign will also cause R CMD check to throw a NOTE that you will
need to explain upon pkg submission to CRAN.

>
> On 9/3/20 5:25 PM, Dan Zigmond wrote:
> > Thanks, Gabor. I want these to be easily available to package users though
> > – that's why they are in the package. So I would rather not "hide" them in
> > a local environment. This is fundamentally a data package, so access to
> > this data is the primary point of installing it.
> >
> > Is there any other solution?
> >
> >   Dan
> >
> > .
> > --
> > Dan Zigmond
> > d...@shmonk.com
> >
> >
> >
> > On Thu, Sep 3, 2020 at 1:40 PM Gábor Csárdi  wrote:
> >
> >> Store the cached data in an environment within the package:
> >>
> >> pali_data <- new.env(parent = emptyenv())
> >>
> >> pali_string_fix <- function() {
> >>pali_data$alphabet <-
> >>   stringi::stri_unescape_unicode(pali_alphabet)
> >> ...
> >> }
> >>
> >> Gabor
> >>
> >> On Thu, Sep 3, 2020 at 9:33 PM Dan Zigmond  wrote:
> >>>
> >>> Hi, all. I am developing a package that includes some global variables.
> >>> Because these are non-ASCII, I have escaped them. But then because these
> >>> are difficult to read, I want to provide an easy way for users to
> >> unescape
> >>> all of them up front. Thus I have code like to create and save the data
> >> in
> >>> global variables in one file:
> >>>
> >>> pali_vowels <-
> >>>c("a", "\u0101", "i", "\u012b", "u", "\u016b", "e", "o")
> >>> pali_consonants <-
> >>>c("k", "kh", "g", "gh", "\u1e45",
> >>>  "c", "ch", "j", "jh", "\u00f1",
> >>>  "\u1e6d", "\u1e6dh", "\u1e0d", "\u1e0dh", "\u1e47",
> >>>  "t", "th", "d", "dh", "n",
> >>>  "p", "ph", "b", "bh", "m",
> >>>  "y", "r", "l", "v", "s", "h", "\u1e37", "\u1e43")
> >>> pali_alphabet <-c(pali_vowels, pali_consonants)
> >>> use_data(pali_alphabet, overwrite = TRUE)
> >>>
> >>> and then I try to export a function like this in another file:
> >>>
> >>> pali_string_fix <- function() {
> >>>pali_alphabet <<-
> >>>   stringi::stri_unescape_unicode(pali_alphabet)
> >>># Several more of these...
> >>>}
> >>>
> >>> The idea is that users can run pali_string_fix() once when they load the
> >>> package and then they won't need to deal with all the Unicode escape
> >>> sequences after that.
> >>>
> >>> However, this is getting rejected by the CRAN checks with the message:
> >>>
> >>> * checking R code for possible problems ... [4s] NOTE
> >>> pali_string_fix: no visible binding for '<<-' assignment to
> >>>'pali_alphabet'
> >>>
> >>> I'm guessing this is because the data and the function are defined in
> >>> different files, so even though those globals are defined by my package,
> >>> that isn't obvious when the check is run on this code.
> >>>
> >>> Does anyone have advice for how to fix this?
> >>>
> >>>   Dan
> >>>
> >>> .
> >>> -
> >>> Dan Zigmond
> >>> d...@shmonk.com
> >>>
> >>>  [[alternative HTML version deleted]]
> >>>
> >>> __
> >>> 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
> >
>
> __
> R-package-devel@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-package-devel



-- 
Joshua Ulrich  |  about.me/joshuaulrich
FOSS Trading  |  www.fosstrading.com

__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel


Re: [R-pkg-devel] url checks not working for me

2020-08-26 Thread Joshua Ulrich
l.pone.0142533
> > > (moved to
> > >
> > https://journals.plos.org/plosone/article?id=10.1371/journal.pone.0142533)
> > > From: inst/CITATION Status: 200 Message: OK URL: https://geneactiv.org/
> > > (moved to https://www.activinsights.com/) From: inst/doc/GGIR.html
> > Status:
> > > 200 Message: OK URL: https://www.accelting.com/ (moved to
> > > https://accelting.com/) From: inst/doc/GGIR.html Status: 200 Message: OK
> > > URL: https://www.physiology.org/doi/10.1152/japplphysiol.00421.2014
> > (moved
> > > to https://journals.physiology.org/doi/10.1152/japplphysiol.00421.2014)
> > > From: inst/CITATION Status: 200 Message: OK
> > >
> > >   [[alternative HTML version deleted]]
> > >
> > > __
> > > 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



-- 
Joshua Ulrich  |  about.me/joshuaulrich
FOSS Trading  |  www.fosstrading.com

__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel


Re: [R-pkg-devel] Etiquette for package submissions that do not automatically pass checks?

2020-08-14 Thread Joshua Ulrich
On Fri, Aug 14, 2020 at 2:54 PM Duncan Murdoch  wrote:
>
> On 14/08/2020 3:08 p.m., Cesko Voeten wrote:
> > A while ago, I submitted an update to my package 'buildmer' that does not 
> > pass R CMD check. This is deliberate. The package contains functionality to 
> > run on cluster nodes that were set up by the user and needs to access its 
> > own internal functions from there. In previous versions of the package, I 
> > had maintained a list of those functions and clusterExport()ed them, but 
> > that had the side effect of overwriting any same-named user objects on the 
> > user-provided cluster nodes, which I thought was poor form. The update 
> > therefore accesses these functions using ':::', which triggers a check 
> > warning.
> >
> > I thought the etiquette was to explain this in the 'Comments' box when 
> > submitting, but this gave me the same automated message that the package 
> > does not pass checks and that I should fix it or reply-all and explain. 
> > This led me to believe that I should not have used the 'Comments' box for 
> > this purpose, hence I resubmitted the package leaving the comments box 
> > empty, and I replied-all to the subsequent e-mail I got with an explanation 
> > similar to the above.
>
> It seems to me that what you should have done is "reply-all and
> explain", as the automated message said.
>
> > It has now been a while since I sent that e-mail (ten days), and I have yet 
> > to hear back. I was wondering if the message had gotten lost, if they 
> > simply haven't gotten around to it yet (I have no idea how much mail they 
> > receive on a daily basis, but I'd think it's a lot more than I do), or if I 
> > should have handled this differently. Only CRAN can answer the first two 
> > questions, but before I bother them: was this the correct procedure, or 
> > should I simply have done something differently?
> >
>
> You can see the state of your submission using the foghorn package.
> cran_incoming("buildmer") currently shows your package is in the
> "archive", which means "package rejected: it does not pass the checks
> cleanly and the problems are unlikely to be false positives".
>
> I only see version 1.7 there, which may indicate that you resubmitted
> exactly the same package (down to the version number).  As the
> instructions at
> https://cran.r-project.org/web/packages/policies.html#Re_002dsubmission
> say, "Increasing the version number at each submission reduces confusion
> so is preferred even when a previous submission was not accepted."
>
> What I'd suggest now is that you do nothing more for a day or two,
> because CRAN members who aren't on holiday might read and respond to
> your message.  If you don't hear anything, then I'd start over again,
> with a new version number, and an explanation in the comments, and
> likely a followup reply-all.
>
You have more than a few days.  As it says on CRAN:
"CRAN submission is offline from Aug 14 to Aug 24, 2020 (CRAN team
vacation and maintainance work)"

> Alternatively, you could export those troublesome functions from your
> package but document them as for internal use only.  Renaming them with
> a name starting with "." will make them harder for users to stumble
> upon, but you can still access them using buildmer::.something, you
> shouldn't need clusterExport(). Then you will meet the technical
> requirement and not need any explanation.
>
> Duncan Murdoch
>
> __
> R-package-devel@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-package-devel



-- 
Joshua Ulrich  |  about.me/joshuaulrich
FOSS Trading  |  www.fosstrading.com

__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel


Re: [R-pkg-devel] help troubleshooting travis-ci issues?

2019-08-04 Thread Joshua Ulrich
On Sun, Aug 4, 2019 at 4:54 PM Ben Bolker  wrote:
>
> On 2019-08-04 5:43 p.m., Iñaki Ucar wrote:
> > On Sun, 4 Aug 2019 at 23:26, Ben Bolker  wrote:
> >>
> >>
> >>   I'm having some trouble with travis builds of a package (local checks
> >> work fine) and hoping if I can get suggestions for diagnosis &
> >> troubleshooting ...
> >>
> >> The package is 'broom.mixed'; I hadn't changed it in a while, but
> >> recently got a minor pull request which seemed reasonable. I believe the
> >> problems I'm having now are dependency and/or caching problems, not
> >> actually related to the changes in the package.
> >>
> >> The failing build is here
> >>
> >> https://travis-ci.org/bbolker/broom.mixed/builds/567597217
> >
> > I see various "package x was installed by an R version with different
> > internals; it needs to be reinstalled for use with this R version".
> >
> > Top of the page, right side, you should see More options > Caches. Try
> > removing them and restart the build.
> >
> > Iñaki
>
>   I tried that already, thanks.  That's why I'm now suspecting it's some
> kind of mismatch between the Rutter PPAs and the default (?) repos that
> Travis uses.  It would be a little painful, but I could edit out the
> rstan dependency and try the builds with and without Rutter's PPA to
> test that hypothesis ...
>
Try changing:
sudo add-apt-repository -y "ppa:marutter/rrutter"
sudo add-apt-repository -y "ppa:marutter/c2d4u"
to:
sudo add-apt-repository -y "ppa:marutter/rrutter3.5"
sudo add-apt-repository -y "ppa:marutter/c2d4u3.5"

The R C API changed between R-3.4.x and R-3.5.x, which created
incompatibility in packages installed using different versions.  Any R
> 3.6.x should use the "ppa:*3.5" PPAs.


>   cheers
> Ben Bolker
>
>
>
> >
>
> __
> R-package-devel@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-package-devel



-- 
Joshua Ulrich  |  about.me/joshuaulrich
FOSS Trading  |  www.fosstrading.com

__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel


Re: [R-pkg-devel] NOTE for a suggested package

2019-02-23 Thread Joshua Ulrich
You can remove the `library("doParallel")`.  Your call to
requireNamespace() plus calling all doParallel functions with `::` is
sufficient.  That should resolve the NOTE.

On Sat, Feb 23, 2019 at 5:49 PM Mohammad Ali Nilforooshan
 wrote:
>
> I'm struggling to stop receiving a NOTE about a suggested package, and it
> seems to be the problem for many people. Your help is really appreciated.
>
> In the function, I have:
>
> if(requireNamespace("doParallel", quietly=TRUE))
> {
>library("doParallel")
>cl = parallel::makeCluster(ncl)
>doParallel::registerDoParallel(cl)
>Q = foreach(i=ggID, .combine='cbind') %dopar% ## do something
> } else {
>## do something else
> }
>
> In DESCRIPTION, I have:
>
> Suggests:
>doParallel (>= 1.0.14)
>
> This is the NOTE that I receive:
>
> 'library' or 'require' call to 'doParallel' in package code.
> Please use :: or requireNamespace() instead.
> See section 'Suggested packages' in the 'Writing R Extensions' manual.
>
> [[alternative HTML version deleted]]
>
> ______
> R-package-devel@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-package-devel



-- 
Joshua Ulrich  |  about.me/joshuaulrich
FOSS Trading  |  www.fosstrading.com
R/Finance 2018 | www.rinfinance.com

__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel


Re: [R-pkg-devel] nativeRoutines error when using roxygen2 in RStudio

2018-11-07 Thread Joshua Ulrich
ves me:
> > >>>
> > >>> Updating secsse documentation Loading secsse Registered S3 method
> > >>> overwritten by 'dplyr': method from as.data.frame.tbl_df tibble
> > >>> Registered S3 method overwritten by 'geiger': method from
> > >>> unique.multiPhylo ape Error in nativeRoutines[[lib]] <- routines :
> > >>> object 'nativeRoutines' not found
> > >>
> > >> Do you get that error if you run "R CMD check" on the tarball
> > of your
> > >> package?
> > >>
> > >> If so, how comfortable are you with debugging R code?  I can
> > tell you
> > >> how to debug the check process, but it's a little tricky.
> > >>
> > >> Duncan Murdoch
> > >>
> > >>>
> > >>>
> > >>> Any other suggestions?
> > >>>
> > >>> Cheers, Rampal
> > >>>
> > >>> On 02-Nov-18 08:33, Georgi Boshnakov wrote:
> > >>>> Try installing the latest development version of roxygen2, if you
> > >>>> are not using it already.
> > >>>> There was a bug in the released version preventing
> > installation in
> > >>>> some cases.
> > >>>> If you don't want to use development version of roxygen2,
> > >>>> try putting all filenames in the Collate field in DESCRIPTION
> > on one
> > >>>> line and make sure that there is a single space
> > >>>> between them. This should work if your problem is what I think.
> > >>>>
> > >>>> By the way, in such cases you will get more informative
> > messages if
> > >>>> you run devtools::check().
> > >>>>
> > >>>> --
> > >>>> Georgi Boshnakov
> > >>>>
> > >>>>
> > >>>> 
> > >>>> From: R-package-devel [r-package-devel-boun...@r-project.org
> > <mailto:r-package-devel-boun...@r-project.org>] on
> > >>>> behalf of Rampal Etienne [rampaletie...@gmail.com
> > <mailto:rampaletie...@gmail.com>]
> > >>>> Sent: 01 November 2018 22:40
> > >>>> To: r-package-devel@r-project.org
> > <mailto:r-package-devel@r-project.org>
> > >>>> Subject: [R-pkg-devel] nativeRoutines error when using
> > roxygen2 in
> > >>>> RStudio
> > >>>>
> > >>>> Since a few weeks (after updating R-devel and Rtools) I get the
> > >>>> following error when trying to build a package or document
> > it, when
> > >>>> using roxygen2 in RStudio:
> > >>>>
> > >>>> In R CMD INSTALL Error in nativeRoutines[[lib]] <- routines :
> > object
> > >>>> 'nativeRoutines' not found Calls:
> > suppressPackageStartupMessages ...
> > >>>> withCallingHandlers ->  -> load_all -> load_dll
> > Execution
> > >>>> halted
> > >>>>
> > >>>> When I disable roxygen2, I do not get this error, but of
> > course the
> > >>>> documentation is not created.
> > >>>>
> > >>>> I have installed the latest versions of RStudio, Rtools, R-devel,
> > >>>> roxygen2, pkgload, but the problem persists.
> > >>>>
> > >>>> Does anybody have a clue what is causing this? I am using
> > Windows 10,
> > >>>> and the package contains Fortran code.
> > >>>>
> > >>>> Kind regards,
> > >>>> Rampal Etienne
> > >>>>
> > >>>>[[alternative HTML version deleted]]
> > >>>>
> > >>>> __
> > >>>> R-package-devel@r-project.org
> > <mailto:R-package-devel@r-project.org> mailing list
> > >>>> https://stat.ethz.ch/mailman/listinfo/r-package-devel
> > <https://stat.ethz.ch/mailman/listinfo/r-package-devel>
> > >>>
> > >>>
> > >>>  [[alternative HTML version deleted]]
> > >>>
> > >>> __
> > >>> R-package-devel@r-project.org
> > <mailto:R-package-devel@r-project.org> mailing list
> > >>> https://stat.ethz.ch/mailman/listinfo/r-package-devel
> > <https://stat.ethz.ch/mailman/listinfo/r-package-devel>
> > >>>
> > >>
> > >
> >
> > __
> > R-package-devel@r-project.org
> > <mailto:R-package-devel@r-project.org> mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-package-devel
> > <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



-- 
Joshua Ulrich  |  about.me/joshuaulrich
FOSS Trading  |  www.fosstrading.com
R/Finance 2018 | www.rinfinance.com

__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel


Re: [R-pkg-devel] Submission to CRAN when package needs personal data (API key)

2018-09-08 Thread Joshua Ulrich
Hi Rainer,

On Wed, Sep 5, 2018 at 2:28 AM, Rainer Krug  wrote:
> Hi
>
> I have a package at GitHub (https://github.com/rkrug/ROriginStamp) which I am
> pre[paring for CRAN.
>
> It creates a trusted timestamp using the API fro OriginStamp
> (https://originstamp.org/home) which requires an API key. Now this API should
> not be made public, as to much traffic through one API key will lead to it’s
> blocking.
>
> I have stored the key encrypted in the travis.yml, and the package passes all
> tests.
>
> But if I send it to CRAN, it would fail the tests, as the api key is not in
> the package itself.
>
> I could disable all tests for CRAN which need the API key, but I think it
> would be better tu run the tests there as well (as an additional check to
> travis).
>
> My question:
>
> Is there a way of storing the API key encrypted, so that only the CRAN test
> servers can decrypt it, or is there another way can steal with this?
>
I have a similar issue with quantmod.  I need API keys to test some
functionality and I would like the tests run regularly, so I can know
when something breaks without having to wait for a user to report the
change.

I store the API keys in encrypted environment variable in TravisCI,
and I check for those environment variables before running the tests
that require them.

Then I added a cron job on TravisCI to run the build if there hasn't
been a build in the past 24 hours.  That solves the problem adequately
for my purposes without adding any burden to CRAN.  Hopefully it works
for your purposes too.

Best,
Josh

> Thanks,
>
> Rainer
>
>
>
> --
> Rainer M. Krug, PhD (Conservation Ecology, SUN),
> MSc (Conservation Biology, UCT), Dipl. Phys. (Germany)
>
> University of Zürich
>
> Cell:   +41 (0)78 630 66 57
> email:  rai...@krugs.de
> Skype:  RMkrug
>
> PGP: 0x0F52F982
>
>
>
>
> ______
> R-package-devel@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-package-devel
>



-- 
Joshua Ulrich  |  about.me/joshuaulrich
FOSS Trading  |  www.fosstrading.com
R/Finance 2018 | www.rinfinance.com

__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel


Re: [R-pkg-devel] Warnings and error message in CRAN Package Check Results

2018-03-24 Thread Joshua Ulrich
On Sat, Mar 24, 2018 at 6:42 PM, Wenchao Ma <wenchao2...@gmail.com> wrote:
> Dear Duncan,
>
> Thank you. I really appreciate your help!
>
> Yes, the Fedora warning is self explanatory, but I'm still quite confused.
> Below are part of my Mstep.cpp file (both functions are in the same file).
> The fedora warned me that, among others,
> Mstep.cpp:62:69: warning: explicitly assigning value of variable of type
> 'int' to itself [-Wself-assign]
> arma::vec Pj = Calc_Pj(par = par, designMj = designMj, linkfunc =
> linkfunc, boundary = boundary, eps = eps);
> ^
> 
>
> So, basically, I called Calc_Pj function from Calc_Pj_jac function, but not
> sure why this is not allowed.
>
The compiler isn't complaining about the function call. It's warning
about all the assignments you make in the function call.

Like Duncan said, the compiler thinks you have something like "i = i"
in your code.  Which you do, for every argument to the function.

You seem to confuse calling functions in R with calling functions in
C++.  C++ function arguments do not have names. They are matched by
position.  Note that none of the other function calls in the file use
"named arguments".

> 
>
> // [[Rcpp::depends(RcppArmadillo)]]
> #include 
> using namespace Rcpp;
> using namespace arma;
> // [[Rcpp::export]]
> arma::vec Calc_Pj(const arma::vec  par, const arma::mat  designMj,
> const int & linkfunc,int boundary = 0,const double  eps = 1e-16){
>   arma::vec Pj;
>   if(linkfunc==1){ //identity
> Pj = designMj*par;
>   }else if(linkfunc==2){//logit
> Pj = exp(designMj*par)/(1 + exp(designMj*par));
>   }else if(linkfunc==3){//log
> Pj = exp(designMj*par);
>   }
>   if(boundary==1){
> Pj.elem(find(Pj<eps)).fill(eps);
> Pj.elem(find(Pj>1-eps)).fill(1-eps);
>   }
>   return Pj;
> }
>
> // [[Rcpp::export]]
> arma::mat Calc_Pj_jac(arma::vec  par,
>   arma::mat designMj,
>   int & linkfunc,
>   int boundary = 0,
>   double eps = 1e-16){
>   arma::mat ret = designMj;
>   if(linkfunc>1){
> arma::vec Pj = Calc_Pj(par = par, designMj = designMj, linkfunc =
> linkfunc, boundary = boundary, eps = eps);
> if(linkfunc==2){//logit
>   ret.each_col() %= Pj%(1-Pj);
> }else if(linkfunc==3){//log
>   ret.each_col() %= Pj;
> }
>   }
>   return ret;
>
> }
>
> On 3/24/2018 6:18 PM, Duncan Murdoch wrote:
>>
>> On 24/03/2018 9:28 AM, Wenchao Ma wrote:
>>>
>>> Dear all,
>>>
>>> I just submitted a package to CRAN. It went well on my computer and
>>> winbuilder, but produced warning and error messages on some linux and
>>> solaris systems, as shown here:
>>> https://cran.r-project.org/web/checks/check_results_GDINA.html
>>>
>>> Does anyone know what is going on here?
>>
>>
>> The compilers on those systems are set up to be more sensitive to coding
>> problems than yours.
>>
>> The Solaris error comes from your code
>>
>>   arma::umat B = arma::ones(K,pow(2,K)-K-1);
>>
>> The library you're using has no function definition for pow() that takes 2
>> integers.  If a float or double result is okay, you could use pow(2.0, K).
>> If you really need an int in that argument, you'll need to typecast or write
>> your own pow() function.
>>
>> The Fedora warning seems self explanatory:
>>
>> Mstep.cpp:62:69: warning: explicitly assigning value of variable of type
>> 'int' to itself [-Wself-assign]
>>
>> Take a look at that line (and the other similar ones) and see why the
>> compiler thinks you've got something like
>>
>> i = i;
>>
>> in your code.
>>
>> Duncan Murdoch
>
>
> __
> R-package-devel@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-package-devel



-- 
Joshua Ulrich  |  about.me/joshuaulrich
FOSS Trading  |  www.fosstrading.com
R/Finance 2018 | www.rinfinance.com

__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel


Re: [R-pkg-devel] Help with CRAN error

2018-02-04 Thread Joshua Ulrich
On Sun, Feb 4, 2018 at 12:47 PM, Dev Chakraborty <dpc10s...@gmail.com> wrote:
> Dear All,
>
> I get the following message on running R CMD check -- as - cran:
>
> Package has a VignetteBuilder field but no prebuilt vignette index.
>
> I do not know how to fix this. Any help will be appreciated.
>
I don't know how to fix it either.  That said, often a great first
step is to search for the error.  A Google search for, "Package has a
VignetteBuilder field but no prebuilt vignette index.", which points
to: https://stackoverflow.com/q/30976308.

And a Google search "VignetteBuilder" has several promising "how to"
results, and there is a "Non-Sweave Vignettes" section of Writing R
Extensions:
https://cran.r-project.org/doc/manuals/r-release/R-exts.html#Non_002dSweave-vignettes.

It will be easier for others to help you if you can do some
investigation on your own and come back with more specifics.

> Sincerely,
>
> Dev
>
>
> --
> Dev Chakraborty, PhD
> Professor of Radiology retired
>
> [[alternative HTML version deleted]]
>
> __
> R-package-devel@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-package-devel



-- 
Joshua Ulrich  |  about.me/joshuaulrich
FOSS Trading  |  www.fosstrading.com
R/Finance 2018 | www.rinfinance.com

__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel


Re: [R-pkg-devel] Help with correcting error in package

2018-02-03 Thread Joshua Ulrich
On Sat, Feb 3, 2018 at 11:44 AM, Dev Chakraborty <dpc10s...@gmail.com> wrote:
> Dear All,
>
> I tried unsuccessfully to upload a package named RJafroc to CRAN. On my OSX
> machine it passes R CMD Check with no errors, warnings or notes. However, I
> get the following output from CRAN, from which I cannot tell which function
> is causing the error (I am truncating the intermediate lines, which appear
> to be the opening screen upon starting R, with ellipses; the full output
> produced by the CRAN pre-test is attached):
>
Submit your package to http://win-builder.r-project.org.  That will
provide you access to all the output in the Rcheck.RJafroc directory.

Also note that the "Confirmation" step of the submission process
suggests, "You could [run R CMD check] using the win-builder service
at http://win-builder.r-project.org;.  And the CRAN Repository Policy
says, "It should be normal for those without Windows machines of their
own to use the winbuilder service to check a package before
submission."  You could also use https://builder.r-hub.io/.  Both are
great resources for the community.

>
>
> *** running examples for arch 'x64' ... ERROR*
>
>
> *Running examples in 'RJafroc-Ex.R' failed*
>
>
> *The error occurred in:*
>
>
> *R Under development (unstable) (2018-02-01 r74194) -- "Unsuffered
> Consequences"*
>
> *Copyright (C) 2018 The R Foundation for Statistical Computing*
>
> *Platform: x86_64-w64-mingw32/x64 (64-bit)*
>
>
> *R is free software and comes with ABSOLUTELY NO WARRANTY.*
>
> *You are welcome to redistribute it under certain conditions*
>
>
> *...*
>
> *...*
>
> *Type 'q()' to quit R.*
>
>
> *> pkgname <- "RJafroc"*
>
> *> source(file.path(R.home("share"), "R", "examples-header.R"))*
>
>
> Thanking you in advance for any help rendered,
>
> Sincerely,
>
> Dev
>
> --
> Dev Chakraborty, PhD
> Professor of Radiology, retired
> __
> R-package-devel@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-package-devel



-- 
Joshua Ulrich  |  about.me/joshuaulrich
FOSS Trading  |  www.fosstrading.com
R/Finance 2018 | www.rinfinance.com

__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel


Re: [R-pkg-devel] Conditionally register method with generic in other package

2018-01-22 Thread Joshua Ulrich
For posterity, the solution I employed did not register the method as
a formal S3 method.  Functionality in package B was unchanged as long
as package B was loaded and attached... which was good enough for my
purposes.

On Wed, Dec 6, 2017 at 6:45 AM, Joshua Ulrich <josh.m.ulr...@gmail.com> wrote:
> I have a feeling I know the answer to this question, but I'm asking
> with the hope that I learn something new.
>
> Package A defines a S3 generic function, "foo()".  Package B defines a
> S3 class "bar", and a foo.bar() method.  This method is not strictly
> necessary for the package to function, and package A has many
> dependencies.
>
> To avoid excessive dependencies, I would like to only register
> foo.bar() if package A is installed at the time package B is
> installed.  If package A is installed after package B, then warn the
> user when package B is loaded and/or attached, so they can re-install
> A and have foo.bar() registered correctly.
>
> I could figure out a way to do this manually, but doubt it would be
> CRAN-approved.  What is the recommended way to handle this situation?
> I've received one suggestion to split B into 2 packages: one without
> the method, and one with.  Are there other alternatives?
>
> Thanks,
> Josh
>
> --
> Joshua Ulrich  |  about.me/joshuaulrich
> FOSS Trading  |  www.fosstrading.com
> R/Finance 2018 | www.rinfinance.com



-- 
Joshua Ulrich  |  about.me/joshuaulrich
FOSS Trading  |  www.fosstrading.com
R/Finance 2018 | www.rinfinance.com

__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel


Re: [R-pkg-devel] Conditionally register method with generic in other package

2017-12-07 Thread Joshua Ulrich
Bill, Duncan,

Thanks for the replies.

On Wed, Dec 6, 2017 at 12:51 PM, Duncan Murdoch
<murdoch.dun...@gmail.com> wrote:
> On 06/12/2017 8:44 AM, Bill Denney wrote:
>>
>>
>>> On Dec 6, 2017, at 07:45, Joshua Ulrich <josh.m.ulr...@gmail.com> wrote:
>>>
>>> To avoid excessive dependencies, I would like to only register
>>> foo.bar() if package A is installed at the time package B is
>>> installed.  If package A is installed after package B, then warn the
>>> user when package B is loaded and/or attached, so they can re-install
>>> A and have foo.bar() registered correctly.
>>
>>
>> One simple solution would be to wrap the instantiation of foo.bar in a
>> require test:
>>
>> if (require(A)) {
>>foo.bar <- function(...) {
>>  print("To be or not to be")
>>}
>> } else {
>>message("To use the foo.bar function, please install package A.")
>> }
>>
>
> It's usually better to use requireNamespace("A") instead of require("A")
> (and the quotes are needed in requireNamespace(), but optional in
> require()). That tries to load the package, but doesn't mess with the search
> list.
>
> But that'll likely cause warnings, unless the same condition is used in the
> NAMESPACE file where there should be an entry
>
> S3method(foo, bar)
>
> The thing is, I'm not sure if
>
> if (requireNamespace("A"))
>   S3method(foo, bar)
>
> is legal in a NAMESPACE file.
>
While perhaps not technically illegal, that doesn't work because you need

if (requireNamespace("A", quietly = TRUE)) {
  importFrom(A, foo)
  S3method(foo, bar)
}

to prevent an error about being able to find object 'foo' when loading
B's namespace.  But the importFrom() causes R CMD check to expect a
hard dependency on package A (and all its dependencies), which is what
I'm trying to avoid...


> Duncan Murdoch



-- 
Joshua Ulrich  |  about.me/joshuaulrich
FOSS Trading  |  www.fosstrading.com
R/Finance 2018 | www.rinfinance.com

__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel


Re: [R-pkg-devel] Installing Tests with R Build

2017-11-25 Thread Joshua Ulrich
On Thu, Nov 23, 2017 at 10:05 AM, Bill Denney <b...@denney.ws> wrote:
> Hi Joshua and Dirk,
>
>> On Nov 23, 2017, at 10:17, Dirk Eddelbuettel <e...@debian.org> wrote:
>>
>>
>> On 23 November 2017 at 08:07, Joshua Ulrich wrote:
>> | On Wed, Nov 22, 2017 at 4:21 PM, Bill Denney <b...@denney.ws> wrote:
>> | > When running R BUILD now (via Travis CI), I get an error that the build 
>> failed trying to build the vignettes.  For R CMD install, I can add 
>> --install-tests.  Is there a way to control R BUILD so that the installation 
>> includes test installation?
>> | >
>> | Put the tests you want to install into a directory inside the inst/
>> | directory (e.g. inst/tests/).
>>
>> Which happens to be the default mode of operations with RUnit.
>>
>> And it is a feature that I happen to _like_ a great deal because it permits
>> testing of the _installed_ package which is something you need in real life
>> when eg some of you system libraries may have change.
>
> Putting the tests there seems like a very reasonable solution to the 
> immediate issue.  It contravenes the options to install (or not install) 
> tests ("R CMD INSTALL --install-tests" loses meaning).  I'm going to update 
> the structure of my vignette so that it detects if the tests are there and 
> builds the vignette based on the existence of the tests (making it say 
> "Please install the tests following these instructions...").
>
> I'm immediately ok with reworking the directory structure and tests, but I 
> think it would be preferable long run to:
> Have R CMD BUILD gain an --install-args option so that installation arguments 
> can be controlled (for situations like this and I'm sure others).
>
I just took a closer look at this, and I don't understand why any
change is necessary.  With a package created by package.skeleton():

josh@thinkpad: ~/git
> R CMD build anRpackage
* checking for file 'anRpackage/DESCRIPTION' ... OK
* preparing 'anRpackage':
* checking DESCRIPTION meta-information ... OK
* installing the package to process help pages
* saving partial Rd database
* creating vignettes ... OK
* checking for LF line-endings in source and make files and shell scripts
* checking for empty or unneeded directories
* building 'anRpackage_1.0.tar.gz'


josh@thinkpad: ~/git
> tar -ztf anRpackage_1.0.tar.gz
anRpackage/DESCRIPTION
anRpackage/NAMESPACE
anRpackage/R/
anRpackage/R/file.R
anRpackage/build/
anRpackage/build/partial.rdb
anRpackage/build/vignette.rds
anRpackage/inst/
anRpackage/inst/doc/
anRpackage/inst/doc/file.Rnw
anRpackage/inst/doc/file.pdf
anRpackage/man/
anRpackage/man/anRpackage-package.Rd
anRpackage/tests/
anRpackage/tests/unittests.R
anRpackage/vignettes/
anRpackage/vignettes/file.Rnw

The package builds successfully, and the tests are still in their
tests/ directory.  Now if I install without the --install-tests flag:

josh@thinkpad: ~/git
> R CMD INSTALL anRpackage_1.0.tar.gz 2>/dev/null

josh@thinkpad: ~/git
> ls -l ~/R/library/anRpackage/
total 32
-rw-r--r-- 1 josh josh  420 Nov 25 08:16 DESCRIPTION
drwxr-xr-x 2 josh josh 4096 Nov 25 08:16 doc
drwxr-xr-x 2 josh josh 4096 Nov 25 08:16 help
drwxr-xr-x 2 josh josh 4096 Nov 25 08:16 html
-rw-r--r-- 1 josh josh   59 Nov 25 08:16 INDEX
drwxr-xr-x 2 josh josh 4096 Nov 25 08:16 Meta
-rw-r--r-- 1 josh josh   72 Nov 25 08:16 NAMESPACE
drwxr-xr-x 2 josh josh 4096 Nov 25 08:16 R

You can see there's no tests/ directory.  Now with the --install-tests flag:

josh@thinkpad: ~/git
> R CMD INSTALL anRpackage_1.0.tar.gz --install-tests 2>/dev/null

josh@thinkpad: ~/git
> ls -l ~/R/library/anRpackage/
total 36
-rw-r--r-- 1 josh josh  420 Nov 25 08:17 DESCRIPTION
drwxr-xr-x 2 josh josh 4096 Nov 25 08:17 doc
drwxr-xr-x 2 josh josh 4096 Nov 25 08:17 help
drwxr-xr-x 2 josh josh 4096 Nov 25 08:17 html
-rw-r--r-- 1 josh josh   59 Nov 25 08:17 INDEX
drwxr-xr-x 2 josh josh 4096 Nov 25 08:17 Meta
-rw-r--r-- 1 josh josh   72 Nov 25 08:17 NAMESPACE
drwxr-xr-x 2 josh josh 4096 Nov 25 08:17 R
drwxr-xr-x 2 josh josh 4096 Nov 25 08:17 tests

The tests/ directory is present, and I can run the tests:

josh@thinkpad: ~/git
> Rscript -e 'tools::testInstalledPackage("anRpackage")'
Testing examples for package 'anRpackage'
Running specific tests for package 'anRpackage'
  Running 'unittests.R'
Running vignettes for package 'anRpackage'
  Running 'file.Rnw'

Someone could probably give you specific advice if you share a link to
the code and/or TravisCI log(s).

> Thank you (and Happy Thanksgiving to those celebrating it),
>
> Bill



-- 
Joshua Ulrich  |  about.me/joshuaulrich
FOSS Trading  |  www.fosstrading.com
R/Finance 2017 | www.rinfinance.com

__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel


Re: [R-pkg-devel] Installing Tests with R Build

2017-11-23 Thread Joshua Ulrich
On Wed, Nov 22, 2017 at 4:21 PM, Bill Denney <b...@denney.ws> wrote:
> Hi,
>
> I have a package that I'm trying to make a validation vignette for.  The 
> validation vignette is intended to assist users with documentation that the 
> tests work.
>
> When running R BUILD now (via Travis CI), I get an error that the build 
> failed trying to build the vignettes.  For R CMD install, I can add 
> --install-tests.  Is there a way to control R BUILD so that the installation 
> includes test installation?
>
Put the tests you want to install into a directory inside the inst/
directory (e.g. inst/tests/).  That directory will be copied to the
top-level of the installed package directory.

> Thanks,
>
> Bill
> __
> R-package-devel@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-package-devel



-- 
Joshua Ulrich  |  about.me/joshuaulrich
FOSS Trading  |  www.fosstrading.com
R/Finance 2017 | www.rinfinance.com

__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel


Re: [R-pkg-devel] spurious rchk warning

2017-11-21 Thread Joshua Ulrich
On Mon, Nov 20, 2017 at 8:34 PM, Patrick Perry <ppe...@stern.nyu.edu> wrote:
> One of my packages has what I believe to be spurious rchk warnings:
>
> From
> https://raw.githubusercontent.com/kalibera/cran-checks/master/rchk/results/utf8.out
>
> Package utf8 version 1.1.0
> Package built using 73757/R 3.5.0; x86_64-pc-linux-gnu; 2017-11-20 22:02:23
> UTC; unix
> Checked with rchk version 63f79d910f5835174fcaa5a0a7d2409348f7d2ac
> More information at
> https://github.com/kalibera/cran-checks/blob/master/rchk/PROTECT.md
>
> Function rutf8_as_utf8
>   [UP] unprotected variable ans while calling allocating function
> R_CheckUserInterrupt utf8/src/as_utf8.c:68
>   [UP] unprotected variable ans while calling allocating function
> rutf8_translate_utf8 utf8/src/as_utf8.c:83
>   [UP] unprotected variable ans while calling allocating function
> Rf_mkCharLenCE utf8/src/as_utf8.c:117
>
> The offending function is at
> https://github.com/patperry/r-utf8/blob/master/src/as_utf8.c#L46
>
> I tried to fix the warning in line 64 with
>
> PROTECT(ans = sx); nprot++;
>
> This did not work. Any suggestions?
>
My hypothesis is that your PROTECT and UNPROTECT calls inside the for
loop are leaving 'ans' unprotected at some point.  Consider using
PROTECT_WITH_INDEX() and REPROTECT() instead.

> Thanks,
>
>
> Patrick
>
> __
> R-package-devel@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-package-devel



-- 
Joshua Ulrich  |  about.me/joshuaulrich
FOSS Trading  |  www.fosstrading.com
R/Finance 2017 | www.rinfinance.com

__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel


Re: [R-pkg-devel] Storing Data Used in an Example

2017-09-20 Thread Joshua Ulrich
On Wed, Sep 20, 2017 at 11:32 AM, Roy Mendelssohn - NOAA Federal
<roy.mendelss...@noaa.gov> wrote:
> Hi All:
>
> I have a package whose main function is to download environmental data using 
> a service.  I have added some plot routines,  As it is, my examples of just 
> the downloads push the CRAN limits on time,  so I want the plot examples to 
> use data that has already been downloaded and stored as part of the package.
>
> Questions:
>
> 1.  Most appropriate place to store the example data (they will be .RData 
> files).
>
https://cran.r-project.org/doc/manuals/r-release/R-exts.html#Data-in-packages

> 2.  What size of data set is considered to be getting too large to be 
> appropriate to include in a package.
>
The CRAN Repository Policy says:

"As a general rule, neither data nor documentation should exceed 5MB
(which covers several books). A CRAN package is not an appropriate way
to distribute course notes, and authors will be asked to trim their
documentation to a maximum of 5MB."

> Thanks,
>
> -Roy
>
>
>
> **
> "The contents of this message do not reflect any position of the U.S. 
> Government or NOAA."
> **
> Roy Mendelssohn
> Supervisory Operations Research Analyst
> NOAA/NMFS
> Environmental Research Division
> Southwest Fisheries Science Center
> ***Note new street address***
> 110 McAllister Way
> Santa Cruz, CA 95060
> Phone: (831)-420-3666
> Fax: (831) 420-3980
> e-mail: roy.mendelss...@noaa.gov www: http://www.pfeg.noaa.gov/
>
> "Old age and treachery will overcome youth and skill."
> "From those who have been given much, much will be expected"
> "the arc of the moral universe is long, but it bends toward justice" -MLK Jr.
>
> __
> R-package-devel@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-package-devel



-- 
Joshua Ulrich  |  about.me/joshuaulrich
FOSS Trading  |  www.fosstrading.com
R/Finance 2017 | www.rinfinance.com

__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel


Re: [R-pkg-devel] loadMethod() not available with Rscript

2017-09-20 Thread Joshua Ulrich
Hi Thierry,

On Wed, Sep 20, 2017 at 7:45 AM, Thierry Onkelinx
<thierry.onkel...@inbo.be> wrote:
> Dear all,
>
> Could someone explain this to me? I have a simple script (see below).
> my_function() is an S4 method. The package imports all functions from
> methods that it uses.
>
> When I run the script in a vanilla R session it works. When using
> Rscript I get the error: Error in loadMethod(function (x, ...)  :
> could not find function "loadMethod"
>
> loadMethod() is NOT used in mypackage and not imported.
>
Rscript does not load/attach the "methods" package like is done in an
interactive R session.

Perhaps your package uses a package that needs methods::loadMethod(),
but does not import it correctly?

> library(mypackage)
> my_function()
>
> Best regards,
>
> ir. Thierry Onkelinx
> Statisticus/ Statiscian
>
> Vlaamse Overheid / Government of Flanders
> INSTITUUT VOOR NATUUR- EN BOSONDERZOEK / RESEARCH INSTITUTE FOR NATURE
> AND FOREST
> Team Biometrie & Kwaliteitszorg / Team Biometrics & Quality Assurance
> thierry.onkel...@inbo.be
> Kliniekstraat 25, B-1070 Brussel
> www.inbo.be
>
> ///
> To call in the statistician after the experiment is done may be no
> more than asking him to perform a post-mortem examination: he may be
> able to say what the experiment died of. ~ Sir Ronald Aylmer Fisher
> The plural of anecdote is not data. ~ Roger Brinner
> The combination of some data and an aching desire for an answer does
> not ensure that a reasonable answer can be extracted from a given body
> of data. ~ John Tukey
> ///
>
>
> Van 14 tot en met 19 december 2017 verhuizen we uit onze vestiging in
> Brussel naar het Herman Teirlinckgebouw op de site Thurn & Taxis.
> Vanaf dan ben je welkom op het nieuwe adres: Havenlaan 88 bus 73, 1000 
> Brussel.
>
> __
> R-package-devel@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-package-devel



-- 
Joshua Ulrich  |  about.me/joshuaulrich
FOSS Trading  |  www.fosstrading.com
R/Finance 2017 | www.rinfinance.com

__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel


Re: [R-pkg-devel] Errors in Package Check Results due to package in Suggestions

2017-09-19 Thread Joshua Ulrich
Hi Daniel,

See section 1.1.3.1 of Writing R Extensions:
https://cran.r-project.org/doc/manuals/r-release/R-exts.html#Suggested-packages

On Tue, Sep 19, 2017 at 2:53 AM, Daniel Lüdecke <d.luede...@uke.de> wrote:
> Hi,
>
> I have a package on CRAN where most check results are OK except two with
> errors (one of those two I'm already addressing).
>
> However, the one of the errors
> (https://www.r-project.org/nosvn/R.check/r-release-osx-x86_64/sjstats-00chec
> k.html) is because I use the package "rstanarm" for one of the examples, and
> running this example fails. What would be an appropriate way to deal with
> this issue? My package does not depend on rstanarm, it's "just" a suggestion
> because I needed it for the examples. I'm a bit unsure about the status of
> these check results. When submitting a package, the maintainer is asked to
> address issues from these checks, so I'd like to fix this error. I could, of
> course, wrap the example into a "don't run"-section, but this seems to me
> like a sloppy hack rather than a proper solution...
>
> Best
> Daniel
>
>
> --
>
> _
>
> Universitätsklinikum Hamburg-Eppendorf; Körperschaft des öffentlichen Rechts; 
> Gerichtsstand: Hamburg | www.uke.de
> Vorstandsmitglieder: Prof. Dr. Burkhard Göke (Vorsitzender), Prof. Dr. Dr. 
> Uwe Koch-Gromus, Joachim Prölß, Martina Saurin (komm.)
> _
>
> SAVE PAPER - THINK BEFORE PRINTING
>
> ______
> R-package-devel@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-package-devel



-- 
Joshua Ulrich  |  about.me/joshuaulrich
FOSS Trading  |  www.fosstrading.com
R/Finance 2017 | www.rinfinance.com

__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel

[R-pkg-devel] Need to call strptime() with specific LC_TIME

2017-04-10 Thread Joshua Ulrich
Hi,

I'm looking for any guidance/best-practices about how to deal with an
issue a quantmod user ran into an issue when calling
getSymbols.google():
https://github.com/joshuaulrich/quantmod/issues/140

Google provides a CSV where the dates are specified using English
month abbreviations.  Converting the characters to Date does not work
in any locale that doesn't use those abbreviations.

So I need to call strptime() in a locale that uses English month
abbreviations.  Is there a better solution than this?

lc_time <- Sys.getlocale("LC_TIME")
Sys.setlocale(category = "LC_TIME", locale = "C")
on.exit(Sys.setlocale(category = "LC_TIME", locale = lc_time)

Thanks!

-- 
Joshua Ulrich  |  about.me/joshuaulrich
FOSS Trading  |  www.fosstrading.com
R/Finance 2017 | www.rinfinance.com

__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel


Re: [R-pkg-devel] robust download function in R (similar to wget)?

2016-08-25 Thread Joshua Ulrich
Try downloader: https://cran.r-project.org/package=downloader

On Thu, Aug 25, 2016 at 7:47 AM, Lucas Ferreira Mation
<lucasmat...@gmail.com> wrote:
> I am creating this package <https://github.com/lucasmation/microdadosBrasil>
> that has to download data from some sources that are a bit
> unstable/unreliable. The problem is described in this issue
> <https://github.com/lucasmation/microdadosBrasil/issues/56>.
>
> Is there a more "robust" download fucntion in R?
> Something similar to wget, that would:
>
> - where there are errors, repeat the download a few times before giving up,
> preferably, using partial data on a file being downloaded from previous
> attempts
> - check the integrity of the downloaded file
>
> As this has to be embedded in an R package, the solution needs to be OS
> independent and require no installation of external software by the user.
>
> regards
> Lucas
>
> [[alternative HTML version deleted]]
>
> __
> R-package-devel@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-package-devel



-- 
Joshua Ulrich  |  about.me/joshuaulrich
FOSS Trading  |  www.fosstrading.com
R/Finance 2016 | www.rinfinance.com

__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel


Re: [R-pkg-devel] Handling Not-Always-Needed Dependencies?

2016-08-02 Thread Joshua Ulrich
On Tue, Aug 2, 2016 at 11:26 AM, Thomas J. Leeper <thosjlee...@gmail.com> wrote:
> I have a fairly open-ended question about the handling of package
> dependencies that is inspired by the precise distinction between
> "Depends", "Imports", and "Suggests" listed in DESCRIPTION.
>
> Some background, as I understand it: Prior to requiring package
> namespaces, we listed package dependencies in "Depends" because the
> required package had to be (1) installed and (2) on the search path in
> order to access its functions. After introducing and requiring
> namespaces, there are very few circumstances in which "Depends" is
> needed because functions from the required package can either be
> imported (via "Imports" and NAMESPACE) and/or referred to using the
> `pkg::fun()` style. "Suggests" packages are maybe needed for examples,
> vignettes, etc. but are not installed by default via
> `install.packages()`, so are not guaranteed to be available.
>
> Some observations:
>
> 1. "Depends" seems to be less useful than before, except in rare cases
> where a package needs to be (a) installed, (b) loaded, and (c) on the
> search path. Imports covers most package dependency use cases.
>
> 2. There is a gap in functionality between "Imports" and "Suggests".
> Sometimes there is a need for functions that should be available
> (i.e., installed) but do not need to be loaded or imported because
> they are rarely used (e.g., graphing functions). Importing the
> functions adds bloat but only putting their package in "Suggests" does
> not guarantee availability when, for example, calling
> `requireNamespace()` or `require()`.
>
Maybe I'm missing something, but isn't that the point of calling
requireNamespace()?  For example:
if (requireNamespace("suggestedPackage"))
  stop("suggestedPackage required but not installed")

That doesn't seem like a heavy burden for package writers when writing
infrequently used functions in their package.  You could even add the
install.packages command to the error message to instruct users to
install the required package.

> Suggestion:
>
> Might it be useful to have a category between "Imports" and "Suggests"
> that covers packages that should be installed but not imported?
>
> This could be done by changing `install.packages()` to cover
> "Suggests" by default, changing the meaning of "Depends" and
> "Imports", or adding a new category to DESCRIPTION.
>
I personally would not want install.packages() to install packages I'm
unlikely to actually use.

It's also not clear to me how importing rarely used functions causes
bloat, but installing all packages for all rarely-used functions does
not cause bloat.

> I am interested in hearing your thoughts on this issue.
>
> Best,
> -Thomas
>
> Thomas J. Leeper
> http://www.thomasleeper.com
>
> __
> R-package-devel@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-package-devel



-- 
Joshua Ulrich  |  about.me/joshuaulrich
FOSS Trading  |  www.fosstrading.com
R/Finance 2016 | www.rinfinance.com

__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel


Re: [R-pkg-devel] [R-SIG-Finance] [VC++ calling R] How to create a real-time interactive ticking time-series chart using dygraph via RInside?

2016-04-11 Thread Joshua Ulrich
Please choose *one* _relevant_ mailing list.  Spamming 5 (!)
mailing lists fragments the conversation and makes things difficult
for everyone involved.

On Mon, Apr 11, 2016 at 10:03 AM, Mike Deanza <mikedea...@outlook.com> wrote:
> Hi all,
>
>
> I am trying to figure out how to do this in R and I need your help.
>
>
> My journey started from something like the following:
>
>
> http://stackoverflow.com/questions/11365857/real-time-auto-updating-incremental-plot-in-r/1#1
>
>
> n=1000
> df=data.frame(time=1:n,y=runif(n))
> window=100
> for(i in 1:(n©\window)) {
> flush.console()
> plot(df$time,df$y,type='l',xlim=c(i,i+window))
> Sys.sleep(.09)
> }
>
>
> Then I wanted to make it nicer looking so I went to dygraph.
>
>
> And then, I would like to be able to live send tick data from within Visual 
> C++ so I started to investigate RInside.
>
>
> Following the example code here:
>
>
> http://dirk.eddelbuettel.com/papers/useR2009RcppRInside.pdf
>
>
> I can open an RInside object in VC++, and then send some data to it, and then 
> execute some command in it, and then get data back.
>
>
> It is really great.
>
>
> However, is there a way to have the real-time updating ticking plots to be 
> drawn on dygraph inside RInside?
>
>
> It turns out the dygraph package tends to draw onto a browser. That makes the 
> real-time updating pretty slow.
>
>
> Is there a way to set the dygraph to plot to a GUI window in VC++? For 
> example, a QT or MFC GUI window?
>
>
> My working environment is Win7 64bit ,with VS 2013 and VS2015, QT 5.3 32bit.
>
>
> Could anybody please shed some lights on me?
>
>
> Thanks a lot!
>
>
>
>
>
>
>
> [[alternative HTML version deleted]]
>
>
> ___
> r-sig-fina...@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-finance
> -- Subscriber-posting only. If you want to post, subscribe first.
> -- Also note that this is not the r-help list where general R questions 
> should go.



-- 
Joshua Ulrich  |  about.me/joshuaulrich
FOSS Trading  |  www.fosstrading.com
R/Finance 2016 | www.rinfinance.com

__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel

Re: [R-pkg-devel] Is it possible to reverse engineer a package from the installed library directory ?

2016-03-23 Thread Joshua Ulrich
On Wed, Mar 23, 2016 at 9:25 PM, Ben Bolker <bbol...@gmail.com> wrote:
>
>  You could take your old install and do this:
>
>   library("your_package")
>   funs <- ls(pos="package:your_package")
>   dump(funs,"your_package.R")
>
>   that wouldn't recreate documentation, NAMESPACE files, etc., but it would
> be a start.
>
You might be able to recreate the Rd files using the answers to this
StackOverflow question: http://stackoverflow.com/q/7493843/271616

Using the example in my answer as a starting point:
sink(file="survey.Rd")
utils:::.getHelpFile(as.character(help(survey,package="MASS")))
sink()

It might still need some formatting clean-up, but hopefully that gets
you 80-90% of the solution.

>
> On 16-03-23 04:43 PM, Paul Hurley wrote:
>>
>> Several years ago I assembled some of my own most used code into a
>> package,
>> and had that installed on my machine.  Since then I have lost the source
>> files, but still have the package installed in an old v2.x R installation.
>>
>> I now need to use the package in my current R install, which is v3.1, and
>> won't let me just copy the directory across, as it complains it was build
>> pre v3.  Is it possible to reverse engineer a package back to R source
>> files so I can then rebuild it in a new package ?
>>
>> Thanks
>>
>> Paul.
>>
>> --http://www.paulhurley.co.uk
>>
>> [[alternative HTML version deleted]]
>>
>> __
>> R-package-devel@r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-package-devel
>>
>
> __
> R-package-devel@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-package-devel



-- 
Joshua Ulrich  |  about.me/joshuaulrich
FOSS Trading  |  www.fosstrading.com
R/Finance 2016 | www.rinfinance.com

__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel


Re: [R-pkg-devel] Class with functions as slots

2015-11-18 Thread Joshua Ulrich
On Wed, Nov 18, 2015 at 7:35 PM, Glenn Schultz <glennmschu...@me.com> wrote:
> All,
>
> I have the following class with slots as functions. For the analysis of MBS
> this is good set-up as it allows for a very clean and modular way of
> handling things.  My question is really geared to understanding what is
> happening in R.
>
> Below is the function without sato = NULL R CMD throws a warning global
> variable not defined.  With SATO = NULL I do not get the warning.  Why only
> sato and not two and ten which are also inputs?
>
You use sato in the yr15 function even though it is not an argument to
the function.  Did you forget to add it as an argument to the yr15
function?

> Glenn
>
> # Bond Lab is a software application for the analysis of # fixed income
> securities it provides a suite of applications
> # in addition to standard fixed income analysis bond lab provides # for the
> specific analysis of structured products residential mortgage backed
> securities, # asset backed securities, and commerical mortgage backed
> securities
> # License GPL3 + File License
> # Copyright (C) 2014 Glenn M Schultz, CFA
>
> #' An S4 class whose slots are functions used to propogate
> #' the mortgage rate used to motivate the prepayment model
> #' @slot yr30 A function defining the 30-year mortgage rate as a function
> #' of the 2- and 10-year swap rate
> #' @slot yr15 A function defining the 15-year mortgage rate as a function
> #' of the 2- and 10-year swap rate #' @export MortgageRate
>
> setClass("MortgageRate",
> representation(
> yr30 = "function",
> yr15 = "function"))
>
> #' A constructor function for the class Mortgage Rate
> MortgageRate <- function(){
> sato = NULL
> new("MortgageRate",
> yr30 = function(two = numeric(), ten = numeric(), sato = numeric()) {
> 2.25 + (.06 * two) + (.75 * ten) + sato},
>
> yr15 = function(two = numeric(), ten = numeric()){
> 1.75 + (.06 * two) + (.75 * ten) + sato}
> )}
> __
> R-package-devel@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-package-devel



-- 
Joshua Ulrich  |  about.me/joshuaulrich
FOSS Trading  |  www.fosstrading.com

__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel


Re: [R-pkg-devel] Working with connections

2015-08-09 Thread Joshua Ulrich
On Sun, Aug 9, 2015 at 8:59 AM, Glenn Schultz glennmschu...@me.com wrote:
 Hi All,

 I use connections to open and close data folders needed by my package.
 After each function closes I get the following warnings (depending on the
 connection that has been opened).

 10: closing unused connection 3
 (/Library/Frameworks/R.framework/Versions/3.2/Resources/library/BondLab/BondData/bondlabMBS4.rds)

 Below is the connection function that is related to the above warning:

 #
   #' A connection function to BondData calling MBS cusps
   #'
   #' Opens a connection to the BondData folder to call MBS cusip data
   #' @param MBS.id A character string the MBS.id or cusip number current
 MBS.id is supported
   #' @export
   MBS - function(MBS.id = character){
   MBS.Conn - gzfile(description = paste(system.file(package
 = BondLab),
   /BondData/, MBS.id, .rds, sep = ), open
 = rb)
   MBS - readRDS(MBS.Conn)
   return(MBS)
   close.connection(MBS.Conn)
   }

 I have googled this warning and it seems to be triggered when a function
 terminates and the connection is open.  But, I think the connection function
 closes the connection once the object is returned.  What am I doing wrong?

Your call to return() exits the function, so the close.connection()
call is never evaluated.  Considering using on.exit() to close the
connection, since it will close the connection regardless of how the
function exits (e.g. because of an error).

 -Glenn
 __
 R-package-devel@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-package-devel



-- 
Joshua Ulrich  |  about.me/joshuaulrich
FOSS Trading  |  www.fosstrading.com

__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel


Re: [R-pkg-devel] download.file and https

2015-07-02 Thread Joshua Ulrich
Hi Paul,

On Thu, Jul 2, 2015 at 9:46 PM, Paul Gilbert pgilbert...@gmail.com wrote:
 (This problem with download.file() affects quantmod, and possibly several
 other packages. e.g. getSymbols('M2',src='FRED') fails.)

Thanks for the note.  I'm aware of this, and actually wanted to ask
this list what the best practice was for downloading files from
https URLs.

 I think the St Louis Fed has moved to using https for connections, and I
 believe all the US government web sites are doing this. An http request is
 automatically switched to https. The default download.file method does not
 seem to handle this, but method=wget does:

IIUC, only if your system has wget installed and it is on the search
path.  Another user has suggested setting method=curl, but that has
the same limitations.  I could use RCurl to access these files from
FRED, but I'd prefer a solution that doesn't require an additional
package dependency, if possible.

I don't have a lot of experience with downloading from https URLs in R
(especially on Windows) so I would really appreciate some pointers on
how best to handle this.

  tmp - tempfile()

 download.file(http://research.stlouisfed.org/fred2/series/M2/downloaddata/M2.csv;,
 destfile = tmp)
 trying URL
 'http://research.stlouisfed.org/fred2/series/M2/downloaddata/M2.csv'
 Error in
 download.file(http://research.stlouisfed.org/fred2/series/M2/downloaddata/M2.csv;,
 :
   cannot open URL
 'http://research.stlouisfed.org/fred2/series/M2/downloaddata/M2.csv'



 download.file(http://research.stlouisfed.org/fred2/series/M2/downloaddata/M2.csv;,
 destfile = tmp, method=wget)
snip wget output
 [34519]

 Paul



-- 
Joshua Ulrich  |  about.me/joshuaulrich
FOSS Trading  |  www.fosstrading.com

__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel