create_lesson: Create a Lesson

Description Usage Arguments Value Examples

View source: R/make_lesson.R

Description

Create a Lesson

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
create_lesson(
  lesson_name,
  course_dir = ".",
  verbose = TRUE,
  md_file = NULL,
  make_slide_deck = TRUE,
  slide_id = NULL,
  extract_code = FALSE,
  rmd = extract_code,
  open = FALSE,
  template_slide_id = "143gvqcynq_bl7iVd2G9yjumwJJkAy0S6CyNCsrJ2LgE",
  publish = TRUE,
  add_number = TRUE,
  use_google_drive = FALSE,
  ...
)

create_lessons_from_book(
  course_dir = ".",
  verbose = TRUE,
  make_slide_deck = FALSE,
  ...
)

Arguments

lesson_name

Name of the Lesson to create. This should be human-readable and will be the title of your lesson in your course.

course_dir

directory with course materials

verbose

print diagnostic messages

md_file

Output markdown file to create. If not specified, will take the lesson_name, sub out spaces, lower case it, and use that for the file name.

make_slide_deck

Create a slide deck on Google Slides if no link is provided.

slide_id

ID to slide deck on Google Slides. Caution, this will publish the slide deck to the web.

extract_code

If you have text with #rstats in the slide or #rstats in the Alt-text title, code will be included

rmd

Should an Rmd (Rmarkdown) be made versus a Markdown?

open

should the file be opened for editing?

template_slide_id

Slide ID for a template. This template will be copied to your new slide deck.

publish

should the slide be published so slides can be included in the markdown?

add_number

Add a prefix to the file name, such as '00_' for the first file

use_google_drive

passed to gs_slide_df to call gs_to_drive_pngs when putting in PNGs into the lesson.

...

arguments passed to check_didactr_auth

Value

A list of the created markdown manuscript file and script files. create_lessons_from_book will return a list of these lists, one for each lesson in the Book.txt file.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
root_path = tempfile()
course_name = "test"
sc = create_course(course_name, root_path)
verbose = TRUE
out =create_lesson(lesson_name = "how to Do Things",
course_dir = sc$course_dir,
make_slide_deck = FALSE,
open = FALSE)
dir(sc$man_path)
dir(sc$scr_path)
readLines(sc$book_txt, warn = FALSE)
readLines(out$md_file)
in_ci <- function() {
nzchar(Sys.getenv("CI"))
}
## Not run: 
# requires authorization
root_path = tempfile()
course_name = "test"
sc = create_course(course_name, root_path)
verbose = TRUE
out = create_lesson(lesson_name = "how to Do Things",
course_dir = sc$course_dir,
make_slide_deck = !in_ci(),
open = interactive())
dir(sc$man_path)
dir(sc$scr_path)
readLines(sc$book_txt, warn = FALSE)
readLines(out$md_file, warn = FALSE)

## End(Not run)

root_path = tempfile()
course_name = "test"
sc = create_course(course_name, root_path)
verbose = TRUE
x =  system.file("extdata", "Book.txt", package = "didactr")
file.copy(x, sc$book_txt, overwrite = TRUE)
course_dir = sc$course_dir
res = create_lessons_from_book(course_dir = sc$course_dir, open = FALSE,
make_slide_deck = FALSE
)
dir(sc$man_path)
dir(sc$scr_path)
readLines(sc$book_txt)
readLines(res[[3]]$md_file)

muschellij2/didactr documentation built on March 17, 2021, 12:45 p.m.