/climate_viz

Workflow using RStudio linked to a GitHub project, to commit works to git version control, aimed to create ggplot2 plots about climate change metrics

Primary LanguageRMIT LicenseMIT

climate_viz

Workflow using RStudio linked to a GitHub project, to commit works to git version control, aimed to create ggplot2 plots about climate change metrics

Project to practise how to integrate RStudio with GitHub

AIM

I have setup this GitHub repo to practise a new workflow with RStudio project linked to GitHub. Creating a new Project in RStudio and selecting Version Control option, allowing local RStudio project to link with an existing GitHub repository previouisly created, called climate_viz.

RStudio is used to create several R and Rmarkdown scripts, doing commits and pusth GitHub actions to this climate_viz GitHub repo from the IDE.

References

  1. Tutorial for Creating a new RStudio project with GitHub to visualize climate change (CC213). Riffomonas Project https://www.youtube.com/watch?v=d5dUkO5lXds&list=PLmNrK_nkqBpLdTEOj_-bwp58490i8ezRI&index=9

  2. Tutorial to mimic Climate Change temperature visualization from NASA. "Plotting the global temperature index using ggplot2 and NASA GISS data (CC214)"
    https://www.youtube.com/watch?v=fskblEWSeWU. From https://www.youtube.com/@Riffomonas youtube channel

Output

Following the above videos, I am replicating the Global Temperature plot displayed when selecting “Global Temperature” indicator from GISS Surface Temperature Analysis (GISTEMP v4) website.

Data

Data for this visualization download from GISS Surface Temperature Analysis (GISTEMP v4) website from the National Aeronautics and Space Administration Goddard Institute for Space Studies.

https://climate.nasa.gov/

Download data for this plot from

https://data.giss.nasa.gov/gistemp/

Tables of Global and Hemispheric Monthly Means and Zonal Annual Means

We download the CSV file below for this project:

Global-mean monthly, seasonal, and annual means, 1880-present, updated through most recent month: TXT, CSV

GLOBAL LAND-OCEAN TEMPERATURE INDEX

Data source: NASA's Goddard Institute for Space Studies (GISS). Credit: NASA/GISS

Project outline

  1. Learn how to obtain a personal access token in GiHub to Clone the newly created GitHUb repository climate_viz
  1. Create a new version control project in RStudio. And also create new folders within this new project

image image

  1. When creating this new version control project I will need the HTTPS GitHub climate_viz URL address to link my local RStudio Project with GitHub.This will allow me to create new GitHub actions such as Commit and Push from RStudio directly into my GitHub repository

image

image

  1. In RStudio I have created several README files as .md files and save them each of them on the corresponding project sub-folders:
  • Code/README.md
  • data/README.md
  • Figures/README.md
  1. Commit each changes (for start on these README files) from RStudio to GitHub using the Git tab enabled by creating a new version control project in RStudio

image image

  1. Then Push the changes to the GitHub repo to be able to go over the GitHub website and see the new files published in the climate_viz repository

image image

  1. Create several ggplot2 files saved as .png as output of this whole analysis
  • This is the first plot without any enhancements: 01 temperature_index_plot_initial_output

  • Below is a plot after several enhancements on the plot titles and sub-titles design and legends layout 07 temperature_index_title_geom_smooth_legengs_formatted

Finally we place legend inside the plot area

08 temperature_index_legend_position_formatted

  1. In the next phase of this project i will create these plots and publish them to a GitHub website

  2. And finally, create several GitHub actions to automate the refresh of these plots on the above website when new data becomes available. To practise the set of GitHub actions that enable to automate the creation of Markdown and HTML documents

By using this Version Control project in RStudio that links with a GitHub project, I have been able to work seamlesly editing and commiting my files from RStudio into this climate_viz GitHub repo, this is a much faster and steamlined workflow than the one I used to work with two weeks ago.