EcoCommons notebooks are open-source and available on GitHub, making it easy to download and run them locally on your computer using RStudio. Follow the steps below to download, load, and execute the notebooks on your local machine:


1. Download the Notebook from GitHub

bash
git clone https://github.com/EcoCommonsAustralia/notebooks.git
  • Alternatively, you can download the repository as a .zip file and extract it to your local directory.

2. Open the Notebook in RStudio

  • Open RStudio on your computer.
  • From the RStudio menu, select File → Open Project.
  • Navigate to the folder where you downloaded the notebook and open the .Rmd or .qmd file directly from the RStudio interface.

3. Install Dependencies

Ensure all necessary R packages are installed. You can install them by running the following command in the R console:

r
install.packages(c("tidyverse", "raster", "terra", "sf", "sp"))

If you are working with a Quarto notebook (.qmd), install Quarto using the following command:

bash
quarto install

4. Load and View the Notebook

  • Once the notebook is open, switch to Visual Mode (for .qmd) or the R Markdown Preview (for .Rmd).
  • You can toggle between Source Mode and Visual Mode using the buttons at the top right of the editor.

5. Run the Notebook

You can run the notebook in two ways:

  • Line-by-Line Execution: Highlight the code and press Ctrl + Enter (Windows) or Cmd + Enter (Mac).
  • Run Entire Notebook: Use the Run button in the RStudio toolbar to execute the whole notebook.
  • For Quarto notebooks, you can also render the output to HTML using:
bash
quarto render <filename>.qmd

or use the Render button in RStudio.


6. Save and Export Output

  • Once the notebook runs successfully, you can export the output to an HTML, PDF, or Word document.
  • For .Rmd files, use "Knit" in the RStudio toolbar to generate the output.
  • For .qmd files, use "Render" to create the output file.

 Troubleshooting Tips:

  • Make sure all dependencies are installed correctly.
  • Check file paths, especially when loading local data.
  • If the notebook fails to run, check the console for error messages and adjust the code or file settings accordingly.
  • For more help, check the EcoCommons GitHub issues page or contact the EcoCommons support team.