Week 5 ยท Advanced Statistical Programming using R
What does the -u flag do in git push -u origin main?
origin/main as upstream. Plain git push/git pull uses set upstream.Answer: 2) -u links your local branch to its remote counterpart. Verify with git remote -v.
Which .gitignore entry tells Git to ignore all CSV files in your repo?
*.csvcsv/!csv#csvAnswer: 1) *.csv matches any file ending in .csv. csv/ ignores a folder; ! negates a prior rule; # starts a comment.
Which one command renders our .qmd files?
pip rendergit push -u quarto renderrstudio render *.qmdquarto renderAnswer: 4) quarto render renders all (or some) .qmd files with one command.
In which file would you implement a custom color theme for your Quarto website?
styles.css_quarto.ymlabout.qmdindex.qmdAnswer: 1) CSS stands for Cascading Style Sheets and is used to customize the appearance of your website.
Which statements about quarto publish gh-pages are true? (Multiple Answers)
.qmd source files directly to GitHub Pages.gh-pages branch..qmd files from main to gh-pages branch.Answer: 1 & 3) Quarto renders locally, then pushes rendered HTML to a gh-pages branch. Your .qmd source files stay on main and gh-pages contains the rendered output.
Which command creates a new branch eda-plots and switches to it in one step?
git branch eda-plotsgit switch eda-plotsgit switch -c eda-plotsgit merge eda-plotsAnswer: 3) -c creates eda-plots branch and git switch moves us to the created branch.
When is git worktree more appropriate than git stash?
Answer: 4) stash is great for short interruptions. git worktree lets you work on multiple branches in parallel.
You are greeted by this merge conflict:
<<<<<<< HEAD
result <- mean(x, na.rm = TRUE)
=======
result <- median(x, na.rm = TRUE)
>>>>>>> feature-branch
What do you do?
sudo merge.git reset --hard to discard both versions.result <- version you want, delete marker lines.Answer: 3) Pick/ change on of the versions, remove <<<<<<<, =======, >>>>>>>, then mark as resolved.
Why is Pull Request preferred over pushing directly to main in a group project?
main branch on GitHub.Answer: 2) PRs add review, discussion, and isolation. main branch stays stable while work continues on other branches.
You have written several useful R functions. What do you think are advantages of bundling them into an R package rather than a functions.R script? (multiple correct answers)
?my_function works.install.packages(...).Answer: 1, 2 & 4) Docs: roxygen comments for auto-generated help pages.
Distribution: install once, call library(...) to load.
Dependencies: necessary packages in DESCRIPTION installed automatically.