mergeRMD2: Merges Rmd-files into a single 'Arbeitsblatt'

Description Usage Arguments Details Author(s) Examples

Description

Merges Rmd-files into a single 'Arbeitsblatt'

Usage

1
2
mergeRMD2(mergedFileName = "book.Rmd", title = ".", files, preamble,
  print.paths = FALSE, print.newpage = TRUE)

Arguments

mergedFileName

Name of the file containing all merged files, along with its filepath. When filepath is not given, current working directory is assumed.

title

Title of the merged collection of files (e.g. Arbeitsblattname).

files

List of files containing the Rmd files to be merged. Should be provided as c("file path1","file path2", ...). See examples on interactive file selection in the details.

preamble

(Optional) File path to the preamble written in plain Rmd file (meta-text, R code allowed). Preamble will be placed before all exercises. Latex packages should be placed in header_lsg.tex.

print.paths

(By default, FALSE) Indicate whether to print paths of each exercise (provided as clickable links in the final pdf document).

print.newpage

(By default, TRUE) Indicate whether to start each exercise from a new sheet.

Details

Merges Rmd files from different locations into one Rmd file. Relies on packages rmarkdown, knitr, devtools, data.table, idpedu (GitHub).

It is important to state **options(useFancyQuotes = FALSE)** before running the function. It is also preferred to leave free the last line in each .Rmd file to avoid problems with **readLines()** command, which is used in mergeRMD2. The data and figures called in each individual Rmd file must be placed in the same directory as the individual Rmd file. Each exercises with header "Aufgabe" is automatically numbered in the same order as in the **files** argument.

Author(s)

Vasily Tolkachev tolk@zhaw.ch, Oliver Durr oliver.duerr@zhaw.ch

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
## Not run: 

mergeRMD2(mergedFileName = "V:/tolk/Private/PROJECT_02_DUERR/TEST_FILES_2/DUMMY/book4.Rmd",
         title = "Arbeitsblatt 1",
         files = c("V:/tolk/Private/PROJECT_02_DUERR/TEST_FILES_2/DUMMY/HA01.Rmd",
                   "V:/tolk/Private/PROJECT_02_DUERR/TEST_FILES_2/DUMMY/HA02.Rmd"),
         preamble="V:/tolk/Private/PROJECT_02_DUERR/TEST_FILES_2/DUMMY/Preamble.Rmd" ,
         print.paths=T,
         print.newpage=T)

createAB("V:/tolk/Private/PROJECT_02_DUERR/TEST_FILES_2/DUMMY2/book4.Rmd")


#======================================================
# Ways to select files and directories

# 1. Interactively choose directory with GUI window, then apply files crawler
path1=gsub("\\\\", "/", choose.dir())

## or choose specific files
files1=gsub("\\\\", "/", choose.files())

# 2. Replace the address line below with the raw path provided by Windows.

# 3. Copy the text of the file(directory) path from the desired location and run the following
path1=gsub("\\\\", "/", readClipboard())

# Files Crawler
 (files1=list.files(path =path1, pattern = "*.Rmd", full.names=TRUE, recursive = TRUE))

#======================================================


 
## End(Not run)

christophhofer/idpedu documentation built on May 7, 2019, 7:40 a.m.