atmosch-R is a collection of R functions for atmospheric chemistry, mass spectrometry, data processing and analysis.
Use of this software is free (see LICENSE.md
), but please acknowledge or cite,
as appropriate, if you use it. Comments, suggestions, requests, reports of
errors/bugs and submissions of code are welcome.
N.B.: it is strongly recommended to check the results and the output of the functions, and make sure that they work as intended.
Download the atmosch-R archive file
and unzip it in a directory of choice (e.g., D:\My Documents\R Code\
). This creates the
repository directory, called atmosch-R-master
, which contains the atmosch-R files.
Rename the repository directory to atmosch-R/
.
The .Rprofile
file, which contains the customization settings for R, should be located
in the home directory (e.g., D:\My Documents\
). If .Rprofile
does not exist, create it (see
this note,
if working on Windows).
Add the following lines to .Rprofile
:
f.repo <- "D:\\My Documents\\R Code\\atmosch-R"
source(paste(f.repo, "main.R", sep=""))
The variable f.repo
is a string with the path to the repository directory
(atmosch-R/
). Edit f.repo
in .Rprofile
to match the configuration
of the system (e.g., a different directory name or Windows partition letter;
or UNIX-style directory paths for Linux systems).
Restart R. The atmosch-R functions should now be available in the R
workspace and can be listed using the command fListWS("atmosch")
at the R
prompt. The names of all atmosch-R functions begin with lowercase f, followed
by the capitalized function name.
All functions in atmosch-R include a header with a brief description of what the function does, the input, the output, and an example of how it is used.
The chron package is used to handle dates and times. To install chron, type at the R prompt:
install.packages("chron")
and follow the instructions. Optionally, add library(chron)
to .Rprofile
.
The testit package is used for testing. It is not required in order to use the atmosch-R functions. To install testit, type at the R prompt:
install.packages("testit")
and follow the instructions. To run the tests, use the command:
source("test_scripts/all-tests.R")
N.B.: depending on the OS, the user permissions, the R version, etc...,
it may be necessary to add the path of the R package library to .Rprofile
(e.g., .libPaths("D:\\My Documents\\R\\win-library\\3.0"
)
atmosch-R is compatible with openair, a widely used R package for analysis of air quality and atmospheric composition data. To install openair, type at the R prompt:
install.packages("openair")
and follow the instructions. Optionally, add library(openair)
to .Rprofile
.
The openair package uses the POSIX format to handle dates and times, instead of the chron format used in atmosch-R. In addition, several openair functions make assumptions about the names of some key variables, such as: date/time, wind speed, wind direction, etc...
The fOpenair()
function in processData.R
can be used to convert a data.frame
to the format used by openair functions.