Giter Club home page Giter Club logo

purple_air_data_in_r's Introduction

About

This is an vignette for users of PurpleAir sensors to obtain real-time air pollution and meteorological data and to explore various ways of basic data analysis from PurpleAir data. The GitHub site here contains all the files needed for the user to get started quering and exploring PurpleAir data. This project is a part of Research Innovations using Sensor Technology in Environmental Justice Communities (RISE Communities) to provide technical training in the application of low-cost sensors for indoor, outdoor, and personal air monitoring in Environmental Justice communities. The GitHub page is part of the RISE program hosted at Cincinnati Children's Hospital Medical Center August 7-9, 2024.

Goals

  • Explain how to install and load R packages necessary for this vignette.
  • Become familiar with the PurpleAir API dashboard.
  • Create and set API Keys associated with the PurpleAir API dashboard.
  • Query the PurpleAir API dashboard from RStudio.
  • Download PurpleAir data from a single sensor, multiple sensors, sensors within a boundary box, and historical data.
  • Perform basic exploratory analysis of sensor data by creating a simple time series plot.
  • Save and load sensor data to and from the R environment.

Prerequisites

  • A computer running either Windows, Mac, or Linux operating systems.
  • Have both R and RStudio installed in your computer. You can install R on your computer by going to https://cran.r-project.org/ and selecting the R version that is appropriate for your operating system. After installing R, you will then need to install RStudio Desktop.
  • Be familiar with basic operations in the R programming language. If you are not familiar with R, this vignette explains how to install R and RStudio on your computer as well as the basics of R programming, including setting a working directory, becoming familiar with the RStudio environment, opening and using R scripts, writing code and interpreting output, saving and loading data, sourcing a R script, and installing and loading packages. This tutorial is publicly available on GitHub. It is highly recommended that you understand the basics of R before exploring this vignette.
  • A stable internet connection.
  • A Google account or GMail account to log into the PurpleAir API dashboard.

It is assumed the user has a basic understanding of the R programming language but no extensive experience is required. Only essential code is provided in the vignette. Detailed descriptions are included for all the code blocks to explain each process. All the code that is included in the vignette is also available in the purpleair.R file, which is also available on this webpage. If you have never use R or RStudio before, it is highly recommended that you complete the Introduction to R and RStudio vignette on GitHub first before attempting this vignette.

Getting Started

Click here to access the vignette, or click the URL link under the About section on the GitHub page. This should open an HTML document of the vignette in your preferred web browser.

For your convenience, we have taken all the R code provided in the HTML page and saved it into an R script named purpleair.R. It is highly recommended that you follow along with the HTML vignette by downloading purpleair.R that walks through the setup process. The code in the purpleair.R file should be performed by the user as they work through the vignette to get the most out of this tutorial.

First create a new R project inside RStudio (see tutorial for details). The purpleair.R file can then be downloaded and saved into the R project folder by running the corresponding line of code in the R console. Click on the clipboard icon on the top right of the code block below to copy the lines exactly as they appear below. Paste this line into the R console and then click Run or press ENTER to execute the command.

# Download 'purpleair.R' file from GitHub
download.file("https://raw.githubusercontent.com/geomarker-io/purple_air_data_in_R/main/purpleair.R", destfile = "purpleair.R")

Once the files have been downloaded to the R project folder, you can then begin the tutorial by clicking on the purpleair.R file in the Files tab of the Output Pane. All other files that are needed will be created and indicated in the vignette when prompted.

Portions of this vignette use the new PurpleAir R package, developed by Dr. Cole Brokamp at Cincinnati Children's Hospital Medical Center. You can visit the GitHub page of this R package by clicking here.

Additional Links

Learn more about PurpleAir and the PurpleAir Dashboard through the following links:

purple_air_data_in_r's People

Contributors

colegasn avatar

Watchers

Cole Brokamp avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.