Contributions of all kinds are welcome. By offering a contribution, you agree to abide by our Code of Conduct and that your work may be made available under the terms of our license.
-
Before each meeting, anyone who wishes may sponsor a proposal by filing an issue in the GitHub repository tagged "proposal", at least 24 hours before the meeting. Follow the "Proposal Issue Template".
-
A quorum is established in a meeting if half or more of voting members are present.
-
Once a person has sponsored a proposal, they are responsible for it. The group may not discuss or vote on the issue unless the sponsor or their delegate is present. The sponsor is also responsible for presenting the item to the group.
-
After the sponsor presents the proposal, a "sense" vote is cast for the proposal prior to any discussion:
- Who likes the proposal? (+1)
- Who can live with the proposal? (0)
- Who disagrees with the proposal? (-1)
-
If all or most of the group likes or can live with the proposal, it is immediately moved to a formal vote with no further discussion.
-
If most of the group disagrees with the proposal, it is postponed for further rework by the sponsor.
-
If some members disagree they can briefly state their objections. A timer is then set for a brief discussion moderated by the facilitator. After 10 minutes or when no one has anything further to add (whichever comes first), the facilitator calls for a yes-or-no vote on the question: "Should we implement this decision over the stated objections?" If a majority votes "yes" the proposal is implemented. Otherwise, the proposal is returned to the sponsor for further work.
Setup to locally preview the book:
-
Install R (we recommend that you also install and use the RStudio IDE).
-
Open RStudio by clicking on the
novice-py.Rproj
file (if not through RStudio, then open an R console in the location of the Merely Useful repo) and install the dependencies by typing in the console:# Make sure you have remotes installed # install.packages("remotes") remotes::install_deps()
Build and preview from the command line:
This book is written in bookdown. If you want to preview builds on your own computer, please:
make html
and then open_book/index.html
.make pdf
ormake epub
to build PDF and EPUB versions (also in the_book
folder).
Or via RStudio:
- When in the R Project (opened via the
.Rproj
file), use the key bindingsCtrl-Shift-B
to build thehtml
output.
For building the PDF, note that bookdown works best with TinyTeX.
After installing it, you can run make tex-packages
to install all the packages this book depends on.
The main development branch is master
and the website is built on gh-pages
.
To add content, create a new branch in the repository and submit a PR.
Please only create a PR when you are ready for your change to be reviewed and merged in.
In general, only the Rmd
files need to be edited.
When reviewing PRs and making changes, it's probably easier to edit the branch directly and push the change up. For comments, please use the commenting features in the PR.
For larger changes (e.g. making a chapter):
- Pick a chapter (as assigned to or by you) and create a branch to work on for that chapter.
- Make some edits and changes.
- Create a Draft Pull Request to the main repo.
- Add the label "work in progress" to that PR.
- When it's ready for review, remove the label, change the PR status to "Ready to review", and post a note in Slack asking for a reviewer.
For other changes:
- If you are making a smaller change, please create a branch with a meaningful name, submit changes, and ask for a reviewer.
- Finally, if you are doing a major reorganization that involves multiple chapters, please put in a proposal first.
- Add yourself as a reviewer to the PR.
- If making a suggested change to the actual text, please use the
"Insert a suggestion"
- For the "reviewee", please accept those changes. GitHub will insert the suggestion directly as a commit, thus giving attribution to the reviewer. Note: This does not work for multi-line suggestions edits (though you can add more lines in the suggestion if desired).
- For individual chapter reviews, look for consistency, content, clarity of material with exercises. Don't worry too much about grammar appearance, structure, etc. This will be done at the end stage.
-
bookdown's behavior is controlled by the metadata in
_bookdown.yml
and in the YAML header ofindex.Rmd
. Please do not add YAML headers to other.Rmd
files, since it is ignored when building the entire book. -
_bookdown.yml
contains an ordered list of R Markdown chapters and appendices. This list is repeated inMakefile
. -
The first element of each chapter must be a level-1 heading. Anything before this heading is silently ignored.
-
The ID for each chapter and section heading is set by putting
{#some-label}
on the heading line. Please use the stem of the file's name in labels, i.e., start all labels for chapterstuff.Rmd
with the wordstuff
. Also include the course type to the beginning (e.g. "r-", "py-", and "rse-"). -
Each chapter starts with a list of questions and a list of learning objectives and ends with a list of key points. These lists are kept in plain Markdown files in the
questions
,objectives
, andkeypoints
folders respectively so that they can be included in both the chapters and theobjectives.Rmd
andkeypoints.Rmd
appendices. -
The last line in each chapter includes the file
links.md
, which gives symbolic names to all the external links used in the book. Please always use[text][label]
to refer to links and put the URL itself in this file to ensure consistency between chapters. -
Please use the free desktop version of draw.io to draw diagrams. Save the source as
figures/stem/stem.drawio
and export drawings as all of PDF, PNG, and SVG. -
Since LaTeX doesn't understand SVG images, hand-drawn diagrams are included as follows:
- Create an R code block with the header
{r stem-label, echo=FALSE, fig.cap="Some Caption"}
, which means:- Give this figure the ID
fig:stem-label
. (Bookdown automatically putsfig:
in front of figure labels, though it doesn't prefix section labels with anything.) - Don't show the R code used to load the image, just its output (i.e., the image).
- Give the figure the specified caption.
- Give this figure the ID
- Use
insert_graphic("figures/stem/filename.ext")
to include your image. If you are using a.pdf
image, make sure that you have the same file but as a.svg
as well.
- Create an R code block with the header
-
Use
@Name1234
or[@Name1234]
to refer to bibliography entries. These entries must exist in thebook.bib
file. For multiple entries, separate the entries with;
, i.e.[@Name1234;@Name5678]
. -
Use
\@ref(label)
to refer to labels for sections and figures. Note that:- This only inserts the section number, not the words
Chapter
,Appendix
,Section
, orFigure
. - Those are round parentheses, not curly braces.
- If the figure's chunk ID is
stem-label
, usefig:stem-label
to refer to it.
- This only inserts the section number, not the words
-
Glossary entries are in
gloss.md
, which is plain Markdown rather than R Markdown.- To refer to a glossary entry, use a direct link of the form
[text]``(glossary.html#term-label)
. - Glossary definitions are set in bold and use an HTML anchor tag to provide the ID. We should find a more elegant way to do this.
- To refer to a glossary entry, use a direct link of the form
-
There are also some HTML comments containing the word
noindent
left over from formatting with an earlier template. These were used to prevent indentation of the first line of continuation paragraphs. We will find a more elegant way to handle this as we get closer to production. -
Do not use
View()
in your R snippets, as Travis will fail when it tries to launch a viewer from the command line.
See the code and text style guide here.
The process for inserting Python code chunks in R Markdown is the same as for inserting R code chunks. Simply replace {r}
with {python}
on the first line of the fenced code chunk:
```{python}
# Python chunks will also be syntax highlighted
for num in range(5):
print(num)
```
Code chunks have options that apply to both R and Python.
Travis needs to know what packages to install to build the website:
-
For R packages, it is very easy. When in the Merely Useful R Project (by opening the
merely-useful.github.io.Rproj
file), typeusethis::use_package("packagename")
in the R Console. This will add the package dependency to theDESCRIPTION
file under the imports section. -
For Python packages you'll need to add the package to the
.travis.yml
under theaddons
section:
addons:
apt:
packages:
- python3
# Add more packages below here
# and looks like "python3-packagename"
# e.g.:
- python3-numpy
NOTE: This section is only to document what was done and why. This does not need to be done, unless others want to clone this repository for their own purposes.
Final building of the website is done via Travis CI. In order to get Travis set
up to push the final generated book to the master
branch, a GitHub Personal
Access Token (PAT) must be added. This PAT can be generated and assigned to
Travis with the following steps:
- Create a PAT for your account on GitHub (make sure to enable the "repo" scope so that using this token will enable writing to your GitHub repos) and copy the token to your clipboard.
- Go to https://travis-ci.org/USER/REPO/settings replacing
USER
with your GitHub ID andREPO
with the name of the forked repository. - Under the section "Environment Variables", type
GITHUB_TOKEN
in the "Name" text box and paste your personal access token into the "Value" text box. - The
deploy
Travis commands found in.travis.yml
are then used to access this GitHub PAT.