Package 'RepoGenerator'

Title: Generates a Project and Repo for Easy Initialization of a Workshop
Description: 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.
Authors: Jared P. Lander [aut, cre]
Maintainer: Jared P. Lander <[email protected]>
License: MIT + file LICENSE
Version: 0.0.1
Built: 2024-11-11 03:13:46 UTC
Source: https://github.com/jaredlander/repogenerator

Help Index


callGitHubAPI

Description

Function for interacting with the GitHub API

Usage

callGitHubAPI(repoName, token, apiURL = "https://api.github.com",
  path = "/user/repos", encoding = c("json", "form"), method = httr::POST)

createGitHubRepo(repoName, token)

deleteGitHubRepo(owner, repoName, token)

checkGitHubRepoExists(owner, repoName, token)

Arguments

repoName

Name of repo to interact with

token

GitHub Personal Access Token: this should be the actual token, not the name of an environment variable

apiURL

The base URL for the GitHub API, this really should not need to be changed

path

The API endpoint

encoding

The type of encoding for the request, either json of form

method

The method to be used, as an R function, such as POST or GET

owner

GitHub username

Details

Builds up and executes a GitHub API request

Value

An API status

Functions

  • createGitHubRepo: Creating a GitHub Repo

  • deleteGitHubRepo: Deleting a GitHub Repo

  • checkGitHubRepoExists: Check that a GitHub Repo exists

Author(s)

Jared P. Lander


createDownloadText

Description

Builds text for file that downloads data

Usage

createDownloadText(info)

Arguments

info

data.frame listing data sources. Must have at least the following columns: Local (the name the file should be on disk after downloaded), Remote (the URL of the file), Mode (the way to write to disk, either 'w' or 'wb').

Details

Creates a block of code. The first line is a comment of the file name, then is uses download.file() using the remote URL and the local filename.

Value

Returns the block of text

Author(s)

Jared P. Lander

Examples

dataList <- read.csv(system.file('metadata/DataList.csv', package='RepoGenerator'), 
    stringsAsFactors=FALSE, header=TRUE)
cat(RepoGenerator:::createDownloadText(dataList))

createRepo

Description

Creates a new project and pushes it to GitHub

Usage

createRepo(name, path, data, packages = c("here", "knitr", "rmarkdown",
  "tidyverse", "usethis"), user, organizer = user, token = "GITHUB_PAT",
  readme, ssh = TRUE)

Arguments

name

Name to use for project and repo

path

Location for the new project

data

data.frame listing data sources. Must have at least the following columns: Local (the name the file should be on disk after downloaded), Remote (the URL of the file), Mode (the way to write to disk, either 'w' or 'wb').

packages

Vector of packages that the user will be instructed to install.

user

GitHub username

organizer

Name of organizer of class. This can be in the form a a Markdown-style link.

token

The name of the environment variable holding the GitHub access token. This can be set with base::Sys.setenv().

readme

Path to parameterized rmarkdown document with parameters className, organizer and packages. If missing the default from the package is used.

ssh

If TRUE, change the remote to use ssh instead of https

Details

This is designed to make a bare repo to be used for workshops. It will create a new project with a customized README and customized download file. It then pushes this to GitHub.

Value

If all operations are successful, returns TRUE

Author(s)

Jared P. Lander


List of a few datasets commonly used in our workshops.

Description

A dataset containing information about data to download for a workshop.

Usage

datafiles

Format

A data frame with 53940 rows and 10 variables:

Data

Colloquial name of data

Remote

URL of file

Local

Name to use for file on disc

Type

Type of file, such as CSV, Excel

Mode

Way to write file to disc such as 'w' for text files or 'wb' for binary files

Tag

Tag for the type of data

Purpose

What the data is used to show