Git Product home page Git Product logo

firstclasspackage's People

Contributors

dcossyleon avatar

Watchers

 avatar  avatar

firstclasspackage's Issues

package-level documentation

In the R Packages book, what is the purpose of suggesting that the following be added to the package-level .R script for its documentation?

#' @docType package
#' @name foo

Also, it's confusing that the usethis::use_package_doc() does not produce the same output that matches what we see in the example of R Packages, documenting packages.

Some big picture ideas

Hey @dcossyleon,

Working through the tutorial, and I have a few larger structural suggestions now that we can see it all together- which is why this draft is so helpful. This is my current thinking, based on working through this demo data package...

  1. I think it is unfulfilling to start with barebones --> optional description --> fun stuff. I think our abstract thinking about this lead us to a slow start.

  2. To fix this, I think you should start with use_data_raw() and add a simple .R script (this is a manual step that seemed left out in the current version) that takes a built-in dataset that is like iris or even anscombe, just read it in and do something very simple to it, then use_data(overwrite = TRUE) at the end of the script to export the .rda file. The benefit here is that users will (I hope) get the flow of a .R script from data-raw/ -> .rda in the data/ first.

  3. After this series of steps, I did this locally and got my first hurrah moment 🎉

    > devtools::load_all()
    Loading datarrraw
    > anscombe_set1
       x1    y1
    1  10  8.04
    2   8  6.95
    3  13  7.58
    4   9  8.81
    5  11  8.33
    6  14  9.96
    7   6  7.24
    8   4  4.26
    9  12 10.84
    10  7  4.82
    11  5  5.68
    
  4. But now we have also created a bit of tension in their heads: what if I want to use my own data? Perhaps with my silly 🍣 analogy (issue #4 ), we say "but what if I want to catch my OWN fish??" Then we say, we hear you, we get it- as an educator, you really want to use your own stuff. Let's show you how to do that by saving your .csv to the data-raw/ folder.

  5. Now the question is, what should my .R script look like now? Let's make a new one (again, manually) called xxx_load.R (see: https://github.com/jennybc/repurrrsive/tree/master/data-raw). This should be just readr::read_csv() in the .csv, then use_data() out to .rda.

  6. Trust but verify (second 🎉)

    > devtools::load_all()
    Loading datarrraw
    > bakeoff_ratings
    
  7. Now we can introduce check I think.

    ❯ checking for missing documentation entries ... WARNING
      Undocumented code objects:
        ‘anscombe_set1’ ‘bakeoff_ratings’
      Undocumented data sets:
        ‘anscombe_set1’ ‘bakeoff_ratings’
      All user-level objects in a package should have documentation entries.
      See chapter ‘Writing R documentation files’ in the ‘Writing R
      Extensions’ manual.
    
  8. Whoops! You have 3 warnings b/c nothing is documented. That's ok, and actually you could use this data package "as is" if you commit/push to your GitHub. But let's document your datasets because it will save you time and help your learners if they can use ?dataset to see all the info about the variables. So you do use_r() here, then unfortunately copy/paste from here: https://r-pkgs.org/data.html#documenting-data then edit, then ?bakeoff_ratings works (third 🎉 )

  9. Use the MIT license (or anyone) and edit DESCRIPTION (I forgot to do this, DESCRIPTION should go first I think), then run document/check again.

  10. I also documented my first dataset, anscombe_set1 to get rid of warnings; document, check again, then ?anscombe_set1 -- hurray 🎉 .

  11. Add package level documentation using usethis::use_package_doc(), then do usethis::use_tibble() (issue #7 - with the package-level doc open), and it will update it for you. Then update Run devtools::document()/devtools::check(). Yay 🎉 .

  12. Finally (FINALLY), devtools::install(). Then test drive: library(datarrraw); follow Jenny and print one of the datasets- it should be a pretty printed tibble 💐

  13. Next you may want to demo editing the raw .csv before exporting it. Maybe call the new .R script something like xxx_prep.R and include a bit of wrangling code here to showcase how you can do that, and that you can use tidyverse code here (and that because this folder is build ignored, you can use whatever packages you want- it doesn't need to affect the depends/suggests in the pkg description because these scripts are only run manually by you). here was mine

Optional things: adding a README, adding R functions (go elsewhere for all of these things, we link out to r-pkgs)

Also we need a call-out for advanced workflow with GitHub PAT set up

data package, needs dependency?

After running "Check" on my dataset package, getting warnings about needing this dependence. Where could this be coming from? Esp. if all my clean-up scripts are in data-raw/ which should be getting ignored, right?

❯ checking data for ASCII and uncompressed saves ... WARNING
    Warning: package needs dependence on R (>= 2.10)

0 errors ✔ | 1 warning ✖ | 0 notes ✔
> 

��

��

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.