Generates a Project and Repo for Easy Initialization of a Workshop

Generates a project and repo for easy initialization of a GitHub repo for R workshops. The repo includes a README with instructions to ensure that all users have the needed packages, an 'RStudio' project with the right directories and the proper data. The repo can then be used for hosting code taught during the workshop.


CRAN_Status_Badge Travis-CI Build Status AppVeyor Build Status Coverage Status

RepoGenerator

Generates a project and repo for easy initialization of a workshop.

GitHub Token

This is dependent on having a GitHub Personal Access Token (PAT).

First, go to GitHub user settings. Then click on Developer Settings.

On the following page click Personal Access Token.

Then click Generate new token.

Finally, select the Repo option.

The way some of the packages this package depends on are written, require that this code be saved in an environment variable. The best way to do this is to have a file named .Renviron in your home directory which can be located with Sys.getenv('HOME'). The file should look like this.

GITHUB_PAT='LongStringOfNumbersAndLetters'

Generating a Project

To create a project and turn it into a GitHub repo use the createRepo function.

If you have a list of data files stored somewhere that you want the user to download, build a data.frame listing at least the local name to be used for the data, the URL where the data are stored and the mode to write the data such as 'w' or 'wb'. If you don't provide one, the default data stored in my data.world repo will be used. You should also specify a set of packages for the users to install.

data(datafiles, package='RepoGenerator')
datafiles[, c('Local', 'Remote', 'Mode')]
#> 1       DiamondColors.csv
#> 2             diamonds.db
#> 3       ExcelExample.xlsx
#> 4      FavoriteSpots.json
#> 5         flightPaths.csv
#> 6            reaction.txt
#> 7            ribalta.html
#> 8      SocialComments.xml
#> 9         TomatoFirst.csv
#> 10            visited.csv
#> 11     manhattan_Test.rds
#> 12    manhattan_Train.rds
#> 13 manhattan_Validate.rds
#> 14    manhattan_Train.csv
#>                                                       Remote Mode
#> 1  https://query.data.world/s/uVlTdijkCbfac49-3k12tawsmviArp    w
#> 2  https://query.data.world/s/Z5k9W39e1kD5hzcJIcRlFClhIHnw5v   wb
#> 3  https://query.data.world/s/5wa6K_X91yfkf-BVpRe2UIabO5A-QB   wb
#> 4  https://query.data.world/s/033kPeDH9pMdcnhPRIOwhjrw3lpA10    w
#> 5  https://query.data.world/s/IIwWxfh9cTydB8h_OueRyA7yxvZ6bf    w
#> 6  https://query.data.world/s/uDfiLMRxSiB_kQQhEt_LbDGVOcStBR    w
#> 7  https://query.data.world/s/kK6-MCw-EbRmnwP-e2MmhEL82lLU4N    w
#> 8  https://query.data.world/s/vzZ_zJzCqXY_yExaJIt79XkJAqUbe-    w
#> 9  https://query.data.world/s/o_LrhM_oY5dexXVDbsMNxF2JyyIMrg    w
#> 10 https://query.data.world/s/GCIO0yVrO50N130s_CZNK50ujmqrE3    w
#> 11 https://query.data.world/s/tkfdrcapfsw7ihodbjzsdywz7povce   wb
#> 12 https://query.data.world/s/t6nblljn7a5ei6ghdqzkhfynn7iu5b   wb
#> 13 https://query.data.world/s/4tfwbez3ul5ap7apg2ffgltfpzmifm   wb
#> 14 https://query.data.world/s/zGvNwNJbY2470sjsVxYFstm426SEf1    w
packages <- c('caret', 'coefplot','DBI', 'dbplyr', 'doParallel', 'dygraphs', 
              'foreach', 'ggthemes', 'glmnet', 'jsonlite', 'leaflet', 'odbc', 
              'recipes', 'rmarkdown', 'rprojroot', 'RSQLite', 'rvest', 
              'tidyverse', 'threejs', 'usethis', 'UsingR', 'xgboost', 'XML', 
              'xml2')
createRepo(
    # the name to use for the repo and project
    name='WorkshopExampleRepo', 
    # the location on disc to build the project
    path='~/WorkshopExampleRepo',
    # the list of data files for the user to download
    data=datafiles,
    # vector of packages the user should install
    packages=packages,
    # the GitHub username to create the repo for
    user='jaredlander',
    # the new repo's README has the name of who is organizing the class
    organizer='Lander Analytics',
    # the name of the environment variable storing the GitHub PAT
    token='MyGitHubPATEnvVar'
)

GitHub

The earlier code created this repo on GitHub. You can point your attendees to the repo you created for easy instructions on getting ready for the workshop!

News

Version 0.0.2

  • Tracking the .gitignore file

Version 0.0.1

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("RepoGenerator")

0.0.1 by Jared P. Lander, a year ago


https://github.com/jaredlander/RepoGenerator


Report a bug at https://github.com/jaredlander/RepoGenerator/issues


Browse source code at https://github.com/cran/RepoGenerator


Authors: Jared P. Lander [aut, cre]


Documentation:   PDF Manual  


MIT + file LICENSE license


Imports rstudioapi, git2r, rmarkdown, httr

Suggests testthat, covr

System requirements: GitHub, 'RStudio'


See at CRAN