read.table
(in
utils
).mydata <- import(file = file.choose(), file.type="csv",
header.at = 1, data.at = 2,
eof.report = NULL, na.strings = c("", "NA"), quote=""",
date.name = "date", date.break = "/", date.order = "dmy",
time.name = "date", time.break = ":", time.order = "hm",
time.format ="GMT",
is.ws = NULL, is.wd = NULL, is.site = NULL,
misc.info = NULL,
bad.24 = FALSE,
correct.time = NULL,
output = "final")
file =
file.choose()
, opens browser. Alternatively, the use of read.table
(in
utils
) also allows this to be a character vector of a file
path, connection or url (althoas.POSIX*
functions for further information.output = "final"
setting, the function returns a data frame for use in openair. By
comparison to the original file, the resulting data frame is modified as
follows: Time and date information will combined in a single column
"date", formatted as a conventional timeseries (as.POSIX*). Time
adjustments may also be made, subject to bad.24 and correct.time
argument settings. Columns identified as wind speed and wind direction
information using "is.ws" and "is.wd", respectively, will be renamed "ws" and "wd",
respectively. An additional "site" column will be generated if enabled by "is.site".
Any additional information (as defined in "misc.info") and data adjustments
(as set in''bad.24' and 'correct.time') will be retained in the data
frame comment.
Using the alternative output = "working"
setting,
the function returns a list containing separate data frames for the different elements of the
data frame (data, names, date, misc.info, etc.).import()
function was
developed to import and format data for direct use
with the openair package. The main intention was to simplify initial data
handling for those unfamilar with R, and, in particular, associated time series
formatting requirements. Using default settings, import()
imports files
configured like example file "example data long.csv" (supplied with
openair or available from the openair website).
Other similar file structures can be readily imported by modifying the function
arguments.
More complex data importing and formatting can be achieved
using an import wrapper. For example, the importAURNCsv
is an import
wrapper that uses import()
with modified arguments to import data
previously downloaded from the UK AURN database. This enforces unique handling of "is.site" and
employs two additional arguments, "data.order" and "simplify.names" and
rbind
(in reshape
) to complete additional
reformatting.importAURN
, importAURNCsv
, importKCL
,
importADMS
, etc.##########
# example 1
##########
# data obtained from http://www.openair-project.org
#import data as mydata
## mydata <- import("example data long.csv")
#use openair function
## polar.plot(mydata, pollutant="nox")
Run the code above in your browser using DataLab