Giter Site home page Giter Site logo

nytimes / gunsales Goto Github PK

View Code? Open in Web Editor NEW
130.0 130.0 35.0 2.6 MB

Statistical analysis of monthly background checks of gun purchases

Home Page: http://www.nytimes.com/interactive/2015/12/10/us/gun-sales-terrorism-obama-restrictions.html

R 100.00%

gunsales's People

Contributors

eddelbuettel avatar gka avatar joshkeller avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gunsales's Issues

examples failing on CRAN oldrel and Solaris

Sorry, only realized it now that you may have this problem on CRAN: The examples will cause ERRORs on the Win oldrel and Solaris platform, as X-13 is (currently) not working there. The ggseas package had the same problem.

#' @examples
#' gs <- analysis()
#' plot_gunsales(gs)
#' ggplot_gunsales(gs)

For seasonal, I put all the examples inside \dontrun{}, e.g. here.

To actually run tests on the CRAN machines, I put them inside this condition:

r.version <- paste(R.Version()$major, R.Version()$minor, sep = ".")
is.oldrel <- .Platform$OS.type == "windows" && (compareVersion(r.version, "3.1.3") < 1)
if (x13binary::supportedPlatform() && !is.oldrel){
}

See here.

The oldrel issue is hopefully temporary and will be resolved with a new R Version. Later on, we could also wrap the examples in:

if (x13binary::supportedPlatform(){
}

can't run analysis()

@eddelbuettel just tried to install and run gunsales on a fresh macbook, but it failed. here's what I did:

Install drat

> install.packages("drat", repos="http://cran.rstudio.com")

and make load by default

$ echo 'drat:::add("ghrr")' >> ~/.Rprofile

Then I installed gunsales

> install.packages('gunsales')
--- Please select a CRAN mirror for use in this session ---
also installing the dependenciesx13binary’, ‘seasonalWarning: unable to access index for repository http://ghrr.github.io/drat/bin/macosx/mavericks/contrib/3.2:
  cannot open URL 'http://ghrr.github.io/drat/bin/macosx/mavericks/contrib/3.2/PACKAGES'

  There is a binary version available but the source version is later:
         binary source needs_compilation
seasonal  1.1.0  1.1.6             FALSE

trying URL 'https://cran.rstudio.com/bin/macosx/mavericks/contrib/3.2/x13binary_0.1.0.tgz'
Content type 'application/x-gzip' length 2155861 bytes (2.1 MB)
==================================================
downloaded 2.1 MB


The downloaded binary packages are in
    /var/folders/3m/lx3m2s9n4yxbr8r7vnqnyyhw0000gn/T//RtmpfHchoX/downloaded_packages
installing the source packagesseasonal’, ‘gunsalestrying URL 'http://ghrr.github.io/drat/src/contrib/seasonal_1.1.6.tar.gz'
Content type 'application/octet-stream' length 470403 bytes (459 KB)
==================================================
downloaded 459 KB

trying URL 'http://ghrr.github.io/drat/src/contrib/gunsales_0.1.0.tar.gz'
Content type 'application/octet-stream' length 679990 bytes (664 KB)
==================================================
downloaded 664 KB

* installing *source* packageseasonal...
** R
** data
*** moving datasets to lazyload DB
** demo
** inst
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded
* DONE (seasonal)
* installing *source* packagegunsales...
** R
** data
*** moving datasets to lazyload DB
** inst
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded
* DONE (gunsales)

The downloaded source packages are in/private/var/folders/3m/lx3m2s9n4yxbr8r7vnqnyyhw0000gn/T/RtmpfHchoX/downloaded_packages

Then I tried to load and run it but I get this error:

> library(gunsales)
> analysis()
Error in UseMethod("mutate_") : 
  no applicable method for 'mutate_' applied to an object of class "function"

Travis CI ?

Shall we enable continuous integration via Travis CI?

I have it working over here as you can in this diff which I did in my older fork because one has to give Travis CI read access to the repo -- which I cannot do here (your repo) but was able to do over on my side.

I am a big fan of continuous integration. It catches simple little errors fast which is a good thing, and keeps a tab on ongoing quality. I would be in very much in favour, but I cannot really send a PR before you agree to turn this on (and if you are agreeing in principle but are confused about the step I would be glad to walk you through over a hangout or phone call).

CRAN upload?

@gka @joshkeller,

The package is ready: R CMD check --as-cran passes without any issues for R-release and R-devel; the dependencies are all uploaded and available in binary. I also sent it to win-builder where it was processed just fine; results are available for r-release and r-devel (but will disappear withing 72 hours).

So I think this is ready to be uploaded. I currently have my name in DESCRIPTION as Maintainer: but it really is your package. Do you want to change the name and upload, and or there reasons (too busy, too much paperwork, ...) why you'd want me to upload it? I'd be happy to, but I want to make sure I am not seen as 'taking it' it from you.

Updated code and automatic seasonal / x13as deployment

@gka, @joshkatz : Congrats on the "gun sales" piece, and the fact that you documented code and data. That's how it should be done.

I had worked a litte with x-12 in the past, and also made some R package deployment more automatic w.r.t some external dependencies -- so I suggested to @christophsax to do something similar for his very nice seasonal package. And so we did over the last few days.

This now works and "should be on CRAN soon". In the meantime I have put packages for x13binary and the development branch of seasonal into this drat repo so that you can just install seasonal from it via install.packages() -- it will now pull in x13binary which in turn will pull in working x13ashtml binaries on Windows, OS X, and Linux. The packages I uploaded are in source form (as I work on Linux) so you may need to add `type="source" but I could add Windows binaries if that helped you.

So the main thing is that we can now make the gun sales analysis truly automatic and failsafe. x13 will work. I intend to make a few more local changes to your code. I have a preference for also keeping project code in packages -- no disrespect to your needs package now on CRAN -- so I may just tie this up some more. E.g. the input data sets would then also be part of the package and be found no matter where the starting directory is. All other dependencies are in fact on CRAN so we can really tie this up.

Which leads to my main question; Are you interested in a pull request for that, or would you rather leave this repo as it is? I'd be perfectly happy to push my 'riff' on your work to, say, a repo 'gun-sales-package'.

Cheers, Dirk

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.