converting-repo.Rmd
decampr
is based on some rather fragile regular expressions, particularly for extracting the exercise code. It assumes that you have at least two linebreaks separating each exercise. That is:
\*\*\* =sct
\`\`\`{r}
success_msg("Great! You learned some basics about `data.frame`s! Let's move on.")
test_function("colnames", incorrect_msg = "did you use colnames(gap1992)?")
test_function("nrow", incorrect_msg = "did you use nrow(gap1992)")
`` ``` ``
\#\# <- Note there are two line breaks, here
\#\# <- and here!
--- type:MultipleChoiceExercise lang:r xp:100 skills:1 key:d599f92ec8
\#\# Thinking about aesthetics
Now that we've learned a little about the `data.frame`, we can get to the fun part: making graphs.
Comments should not have whitespace after the #
:
##proper comment
## improper comment (will be parsed incorrectly)
Also, make sure the last exercise in your chapter has at least two linebreaks and is followed by a ---
.
decampr
decampr
assumes that your datacamp repo is local to your system.
The first thing to do is to use decampr::create_course_repo()
to clone Ines’ basic course repository to your computer:
This will clone the course-starter-r
repo to your computer (by default, it saves it to your Desktop) and open up a new project with your cloned repo.
Now you can start processing your DataCamp repo:
library(decampr)
repo_path <- "c:/Code/RBootcamp_old"
#get all chapters in the repo path
chapter_list <- get_chapters(repo_path)
#Or, can just get a single chapter
chapter1 <- get_chapter("c:/Code/RBootcamp_old/chapter1.md")
#get all exercises for chapter 1
exercise_list <- get_exercises(chapter_list[[1]])
#could also run on chapter 1
exercise_list <- get_exercises(chapter1)
#extract exercise information
exercise_list <- parse_exercise_list(exercise_list)
#number the exercises
exercise_list <- number_ex_list(exercise_list, basename = "01")
#save the exercises and rewritten chapter.md
save_exercise_list(exercise_list, "chapter1.md", paste0(repo_path, "/", "chapter1.md"))
Exercises/solutions/pre-exercise code will be written to exercises/
and the chapter.md files will be written to chapters/
.
Note that submission correctness tests are not currently captured, nor is the correct answer to the multiple choice exercise captured. The correct answer can be added to that exercise by editing the appropriate chapter.md
file (see Ines` documentation for more info).