Various pems.utils functions to make and import data as pems objects.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
#making pems objects is.pems(x, full.test = TRUE, ...) pems(x, units = NULL, constants = NULL, history = NULL, ...) pems.element(x, name = NULL, units = NULL, ...) #associated isPEMS(...) makePEMS(...) makePEMSElement(...) ## S3 method for class 'data.frame' as.pems(x, ...) #importing data as pems objects #general import2PEMS(file.name = file.choose(), time.stamp = NULL, local.time = NULL, time.format = NULL, units = NULL, constants = NULL, history = NULL, ..., file.type = NULL, file.reader = read.delim) importTAB2PEMS(..., file.reader = read.delim) importCSV2PEMS(..., file.reader = read.csv) #Horiba OBS importOBS2PEMS(file.name = file.choose(), pems = "Horiba OBS", constants = NULL, history = NULL, analytes = c("co", "co2", "nox", "hc"), fuel = c("petrol", "diesel", "gasoline"), ...) importOB12PEMS(file.name = file.choose(), pems = "Horiba OBS", constants = NULL, history = NULL, analytes = c("co", "co2", "nox", "hc"), fuel = c("petrol", "diesel", "gasoline"), ...) #3DATX parSYNC importParSYNC2PEMS(file.name = file.choose(), reset.signals = TRUE, history = NULL, constants = NULL, pm.analyzer = "parSYNC", ... ) #3DATX CAGE importCAGE2PEMS(..., calibrator = "CAGE") #RoyalTek GPS importRoyalTek2PEMS(file.name = file.choose(), file.type = c("special", "txt", "nmea"), vbox = "RoyalTEk", history = NULL, constants = NULL, ...)
(A required object) For
(Optional) Other arguments, handling varies. For
(Default pems arguments) These are arguments that are routinely generated for
(Default pems.element argument)
(file connection, etc.) For
Data reader parameters for some
(Character vectors) For some
(Character vector) For
(Logical or Character vector) For
is.pems tests if an object is/is not a
pems makes a
pems object using supplied data and information.
pems.element makes a
pems.element object using supplied data and information.
as.pems... functions attempt to convert a supplied object into a
Currently, there is only a
data.frame method and (by
makePEMSElement are historical code, retained for
import... functions import simple file structures, and are useful for getting
data quickly into
importTAB2PEMS imports tab delimited files and
importCSV2PEMS imports comma delimited files. Both assume a simple
file structure (i.e. data series in columns with names as headers), but require some time data
management by the user. Note: These are wrappers for
import... import specific file types.
importOBS2PEMS imports standard Horiba OBS files and converts them to
objects. See Notes below.
.OB1 files and converts them to
files are generated by a Visual Basic PEMS data handler used during the RETEMM project. Notes below.
importParSYNC2PEMS imports standard parSYNC files and converts them to
objects. See Notes below.
importCAGE2PEMS imports standard CAGE files and converts them to
importParSYNC2PEMS Notes below.
.nmea format Royal Tek GPS files and
converts them to
pems objects. See Notes below.
is.pems return a logical,
TRUE if the supplied object is
FALSE. If the argument
full.test = TRUE is also supplied, additional
information about the object is returned as
pems.element functions return
objects, respectively, made using the supplied file and any additional information also
supplied in the same call.
import... functions return a
pems object, made using the supplied file and any
additional information also supplied in the same call.
makePEMSElement were earlier functions that performed
the same functions as
pems.elements, respectively. The
the current versions of these functions are wrappers for their replacements.
With the crude
import... functions (
importCSV2PEMS) modifications are minimal. Unless any additional changes are requested
import...(...) call, the data is simply read in as a
converted to a
importOBS2PEMS, OBS data is also modified as follows: data series names are simplified and
converted to lower case to simplify use in R; the data series
are added (generated using the file time stamp, the row counter and the log.rate constant);
longitude are resigned according to set N/S and E/W values,
if these are present/valid;
longitude units are also reset to
'd.degLon'. Any data series names in
analytes is renamed
If not supplied in the
importOBS2PEMS, typical OBS constants are currently assumed. Several of these
are based on emission source fuel. Defaults for these are generated according to
importOB12PEMS, handling is similar to that with
importParSYNC2PEMS, the parSYNC data modifications are as follows: parSYNC Date and Time
data-series are merged and converted into
local.time is calculated
from this; the parSYNC data series Timestamp is retained as
parsync.timestamp; by default units are
removed from data-series names, but retained as
units(pems); (again by default) all names are
converted to lower case. The default option
reset.signal = TRUE reverses the voltage reading
of opacity and ionization time-series (x = - x), if present. Alternatively, imports can be identified
specifically by name, e.g.
reset.signal = "opacity" to just reset opacity. Typical OBS constants
are currently assumed, if not supplied. Several of these are based on emission source fuel. The default
assumption is that the fuel is
fuel has been assigned.
importCAGE2PEMS, handling is similar to that with
importRoyalTek2PEMS, the Royal Tek data modifications are currently being documented.
References in preparation.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
########### ##example 1 ########### #make little pems data <- data.frame(speed=1:10, emissions=1:10) units <- c("m/s", "g/s") pems <- pems(x = data, units=units, example="my record") pems #the pems object summary(pems) #summary of held data pems$speed #the speed pems.element #import data file as pems using import... functions #For example, to import CSV file as pems object #pems <- importCSV2PEMS()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.