This is the source for the Introduction to Data Science textbook.
-
Install Docker (instructions here: https://docs.docker.com/get-docker/)
-
Run RStudio inside the
ubcdsci/intro-to-dsdocker container:- in terminal, navigate to the root of this project repo
- type the following in terminal:
docker run --rm -it -p 8787:8787 -v $PWD:/home/rstudio/introduction-to-datascience -e PASSWORD=password ubcdsci/intro-to-ds:v0.1.0- open a web browser and type http://localhost:8787/
- for the username enter
rstudio - for the password enter
password(or whatever you may have changed it to in thedocker runcommand above)
Note, if you prefer not to use RStudio, but a plain text editor instead (i.e., vim) the see these docs below.
-
Finally, you can render the book by running the following R code in the R console:
bookdown::render_book('index.Rmd', 'bookdown::gitbook')
You can use this docker container to edit the files without RStudio using either vim or emacs. This can be done via:
docker run --rm -it -v $PWD:/introduction-to-datascience ubcdsci/intro-to-ds /bin/bash
Data sets are collected and curated by data/retrieve_data.ipynb. To run that notebook in the Docker container type the following in the terminal:
docker run --rm -it -p 8888:8888 -v $PWD:/home/rstudio/introduction-to-datascience ubcdsci/intro-to-ds jupyter notebook --ip=0.0.0.0 --allow-root
- For R code block labels, use the format
##-[name with only alphanumeric + hyphens]where the##is the 2-digit chapter number, e.g.03-test-namefor a labeltest-namein chapter 3
- The files
index.Rmdand##-name.Rmdare R-markdown chapter contents to be parsed by Bookdown _bookdown.ymlsets the output directory (docs/) and default chapter nameimg/contains custom images to be used in the text; note this is not all of the images as some are generated by R code when compilingdata/stores datasets processed during compiledocs/.nojekylltells github's static site builder not to run Jekyll. This avoids Jekyll deleting the folderdocs/_main_files(as it starts with an underscore)
Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0)