2.5.conditioning.pems.data: Data conditioning for pems data

Description Usage Arguments Details Value Warning Note Author(s) References See Also Examples

Description

Various functions for the conditioning of pems objects.

Usage

1
2
3
4
5
cutBy(ref = NULL, ..., data = NULL, cut.method = NULL, 
        labels = NULL, fun.name = "cutBy", hijack= FALSE)

cutByRow(ref = NULL, n = 4, rows = NULL, ..., data = NULL,  
        fun.name = "cutByRow", hijack= FALSE)

Arguments

ref

(Data series typically vector) The reference data series to consider when making a vector of subset markers/indices. See Details.

...

(Optional) Other arguments, currently passed on to pems.utils management functions.

data

(Optional data.frame or pems object) The data source if ref is supplied in either a data.frame or pems object.

cut.method

(Optional function) For cutBy only, the method to use when cutting ref. If not supplied, this is supply cutByRow by default.

labels

(Character vector) For cutBy only, a vector of names to be assigned to the cut regions.

fun.name, hijack

(Various managment arguments) fun.name is the name of the parent function, to be used in error messaging. hijack is a logical) that developers can use to locally 'hijack' this function. See Note on hijack below.

n, rows

(numerics) n sets the number of equal intervals to attempt to cut the data into. rows sets the exact rows at which to cut the data at. If n is applied and the length of ref is not exactly divisible by n a best attempt is made. If both n and rows are set, rows is applied.

Details

cutBy and cutBy... functions generate a vector of subset markers or indices based of the type of cut applied and the range/size of the reference, ref. As elsewhere in pems.utils, by default inputs are returned in the state them are supplied. See Value.

cutBy is a wrapper for other cutBy... functions. It provides additional options for cut.marker naming.

cutByRow assigns cut regions based in row number.

Value

By default results are returned in the supplied format. So: If inputs are supplied as vectors, the answer is returned as a vector; If inputs are supplied in a pems object, that pems object is returned with the answer added in. This behaviour is enabled by the default output = "special".

The cut.marker vector generated by cutBY and cutBy... functions can then be used to condition and subsample data in pems objects.

Warning

Currently, no warnings.

Note

hijack is an in-development argument, supplied to allow code developers to run multiple functions in different function environments. When developers 'mix and match' code from several sources it can become unstable, especially if functions are run within functions within functions, etc. hijack = TRUE and associated code makes a function local to 'side-step' this issue. This work by assuming/expecting all inputs to be local, i.e. supplied directly by the code user.

Various other cutBy... options can be very simply encoded.

Author(s)

Karl Ropkins

References

References in preparation.

See Also

cut, etc. in the main R package.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
###########
##example 1 
###########

#basic usage

#cut into equal subsets
a <- cutBy(velocity, n= 5, data=pems.1)

latticePlot(velocity~local.time|cut, data=a, 
             type="l", layout=c(1,5))

#cut at three points
a <- cutBy(velocity, rows=c(180,410,700), data=pems.1)

latticePlot(velocity~local.time|cut, data=a, 
             type="l", layout=c(1,4))

pems documentation built on May 2, 2019, 5:20 p.m.