Function takes code from referenced code chunk and returns partial code sequence to series of code chunks separated by slide breaks. Upon compiling you get step-by-step code walk-through.

chunk_reveal(chunk_name = NULL, break_type = "auto", left_assign = F,
  left_assign_add = NULL, lang = "r", omit = "#OMIT",
  code_seq = NULL, code_seq_lag = NULL, code_seq_lag2 = NULL,
  code_seq_target = NULL, code_seq_start = NULL, func_seq = NULL,
  num_breaks = NULL, display_type = c("code", "output"), title = "",
  md = NULL, md2 = NULL, replacements = NULL, replace = NULL,
  replacements2 = replacements, replace2 = replace,
  replacements3 = replacements, replace3 = replace, widths = NULL,
  float = "left", chunk_options = "", color = c("black", "black",
  "black"), font_size_code = "80%")

Arguments

chunk_name

a character string referring to the name of the source chunk for the flipbooking

break_type

"auto" is default finding appropriate breakpoints, "user" can be used with the special comment message #BREAK within the source code chunk, "non_seq" can be used for non sequential display of code with special comment messages #BREAK2 (will show in second frame) and #BREAK3 (will show in third frame), an integer input can be given too, to simply display the source code chunk multiple times which is appropriate for observing multiple realizations of sampling, "rotate" allows cycling through different lines of code, the comment #ROTATE is used for lines to by cycled through

left_assign

a logical, default is FALSE, if TRUE will print the object created in the upper left hand corner of the source code chunk at the end of each partial reveal

left_assign_add

a character string containing function for table formatting in output, for left assign case only

lang

a character string indicating what programming language will be used. "r" is default; "python" is experimental

omit

a character string, as a comment, indicating lines that should be omitted, defaults to "#OMIT"

code_seq

a list of code as character strings, the list will automatically be created based on the previous three arguments or the user can input code manually

code_seq_lag

a list of code as character strings, lagged, the list will automatically be created based on the previous three arguments or the user can input code manually

code_seq_lag2

a list of code as character strings, twice lagged, the list will automatically be created based on the previous three arguments or the user can input code manually

code_seq_target

a list of code as character strings, the length of code_seq, but only containing the last element of code_seq

code_seq_start

a list of code as character strings, the length of code_seq, but only containing the first element of code_seq

func_seq

a character string with function names; default is NULL and will reflect whatever function is highlighted from the code sequence

num_breaks

an integer, automatically calculated based on the length of the the code_seq list

display_type

a character string vector, the default is c("code", "output") for code and output to be displayed side-by-side, "output" will create spawned code chunks to only display output, "code" will create spawned code chunks only to show the partial code builds; "func" and "md" may also be displayed

title

a character string that may contain a title for the frames of the flipbook; this may included header info "## My Title" for example is a second level markdown title in Xaringan

md

a character string vector that contains markdown; each element will be shown on a separate slide in the display panel "md" (see display_type)

md2

a character string vector that contains markdown; each element will be shown on a separate slide in the display panel "md" (see display_type)

replacements

a character string vector to be replace the string indicated by the 'replace' parameter

replace

a character string to be replaced in the input code sequentially with the replacement vector elements

replacements2

a character string vector to be replace the string indicated by the 'replace2' parameter

replace2

a character string to be replaced in the input code sequentially with the replacement2 vector elements

replacements3

a character string vector to be replace the string indicated by the 'replace3' parameter

replace3

a character string to be replaced in the input code sequentially with the replacement3 vector elements

widths

a numeric vector containing relative widths for panels

float

defines css float parameter, defaults to "left"

chunk_options

input 'knitr' code chunk options as a string, default to empty string "", useful input might be "fig.height = 4, fig.width = 3"

color

defines css parameter, defaults to "black"

font_size_code

this ain't working yet!

Value

a string object is returned will only work in 'knitr' context