Package 'joholearnr'

Title: Tutorials for Joho-shori-enshu Class at Chiba University
Description: Provides {learnr} tutorials as homework assignments for the Joho-shori-enshu Class at Chiba University, Japan.
Authors: Joel H. Nitta [aut, cre]
Maintainer: Joel H. Nitta <[email protected]>
License: CC BY 4.0
Version: 0.0.0.9000
Built: 2024-11-19 03:35:10 UTC
Source: https://github.com/joelnitta/joholearnr

Help Index


Get last call in user code, excluding comments

Description

Get last call in user code, excluding comments

Usage

last_user_code_call(.user_code)

Arguments

.user_code

User-provided code in a learnr tutorial

Value

The last string provided by the user in their code


List all tutorials

Description

Lists all tutorials (Rmd files) in joholearnr

Usage

list_tutorials()

Value

Character vector

Examples

list_tutorials()

Snapshot all tutorial files

Description

Create an renv.lock file for each tutorial

Usage

snapshot_tutorials(dir = "./inst/tutorials")

Arguments

dir

Directory containing the tutorials. Each should be in its own subdirectory; see system.file("tutorials", package = "joholearnr")

Value

Nothing. Externally, the renv files will be written to disk.

Examples

if (interactive()) {
  tutorials_folder <- system.file("tutorials", package = "joholearnr")
  temp_tutorials_folder <- fs::path(tempdir(), "tutorials")
  fs::dir_copy(tutorials_folder, temp_tutorials_folder, overwrite = TRUE)
  snapshot_tutorials(temp_tutorials_folder)
  fs::dir_delete(temp_tutorials_folder)
}

Object with a long name

Description

This is provided only for practicing using the tab key to autocomplete a long name

Usage

this_is_a_really_long_name

Format

An object of class numeric of length 1.


Write out all tutorial files

Description

Write out all tutorial files (Rmd) file to disk

Usage

write_all_tutorials(dir = ".", delete_html = TRUE)

Arguments

dir

Directory to write the files.

delete_html

Logical; should HTML files in the tutorials directory be deleted after copying?

Value

Nothing. Externally, the file will be written to disk. (Subfolders may be used)

Examples

target_dir <- fs::path(tempdir(), "tutorials")
write_all_tutorials(target_dir)
fs::dir_ls(target_dir)
fs::dir_delete(target_dir)

Write out a tutorial file

Description

Write out a tutorial (Rmd) file to disk

Usage

write_tutorial(tutorial, dir = ".")

Arguments

tutorial

Name of the tutorial file. The .Rmd extension may be omitted.

dir

Directory to write the file.

Value

Nothing. Externally, the file will be written to disk.

Examples

write_tutorial("00-learnr", tempdir())
list.files(tempdir())