Various codes and methods.
#ggplot2 # S3 method for pems
fortify(model, data, ...)
#dplyr (1) standard methods
# S3 method for pems
filter(.data, ...)
# S3 method for pems
arrange(.data, ...)
# S3 method for pems
slice(.data, ...)
# S3 method for pems
mutate(.data, ..., units=NULL, warn=TRUE)
# S3 method for pems
group_by(.data, ..., .add=FALSE)
# S3 method for pems
groups(x)
# S3 method for pems
ungroup(x, ...)
# S3 method for pems
group_size(x)
# S3 method for pems
n_groups(x)
# S3 method for pems
pull(.data, ...)
#dplyr (2) related underscore methods
# S3 method for pems
filter_(.data, ..., warn=TRUE)
# S3 method for pems
arrange_(.data, ..., warn=TRUE)
# S3 method for pems
slice_(.data, ..., warn=TRUE)
# S3 method for pems
mutate_(.data, ..., units=NULL, warn=TRUE)
# S3 method for pems
group_by_(.data, ..., .add=FALSE, warn=TRUE)
#dplyr (3) joining methods
# S3 method for pems
inner_join(x, y, by = NULL, copy = FALSE, ...)
# S3 method for pems
left_join(x, y, by = NULL, copy = FALSE, ...)
# S3 method for pems
right_join(x, y, by = NULL, copy = FALSE, ...)
# S3 method for pems
full_join(x, y, by = NULL, copy = FALSE, ...)
# S3 method for pems
semi_join(x, y, by = NULL, copy = FALSE, ...)
# S3 method for pems
anti_join(x, y, by = NULL, copy = FALSE, ...)
filter returns the supplied pems object after
the requested filter operation has been applied,
e.g.: filter(pems.1, velocity>0.5) returns
pems.1 after excluding all rows where the velocity
value was less than or equal to 0.5.
arrange returns the supplied pems object
reordered based on order of values in an identified
element, e.g.: arrange(pems.1, velocity)
returns pems.1 with its row reordered lowest to highest velocity entry.
slice returns requested rows of the supplied
pems object, e.g.: slice(pems.1, 1:10) returns
rows 1 to 10 of pems.1 as a new pems object.
mutate returns the supplied pems object with
extra elements calculated as requested, e.g.:
mutate(pems.1, new=velocity*2) returns the
pems object with additional column, called new, which
is twice the values in the velocity column. The units
of the new column can be set using the additional
argument units, e.g.
mutate(pems.1, new=velocity*2, units="ick").
group_by returns a grouped_df object,
which allowed by-group handling in subsequent
dplyr code.
The ..._join joining methods, join two
supplied datasets. The first, x,
must be a pems to employ ..._join.pems
but the second, y can be e.g. a
data.frame, etc.
(pems.object) In fortify, the pems
object to be used as a data source when plotting
using ggplot2 code. The method is rotuinely
applied by ggplot2, so users can typically
ignore this. See below.
(Optional) Other arguments, typically passed on to equivalent tidyverse function or method.
(pems.object) For dplyr functions, the pems
object to be used with, e.g. dplyr code.
(Optional) Give warnings? For an underscore methods: a warning that an underscore method was used (See Below). For mutate: if new elements are generated without unit assignments.
(Character) In mutate, the units to assign to new elements created by call. See Below.
(Various) For group... functions, x
is the pems dataset to be grouped.
For ...join functions,
x and y are the two datasets
(pems, data.frame, etc) to
be joined together.
(Optional) Argument used by group_by and
related dplyr grouping functions.
(Various) For ...join functions, consistent
with dplyr, by and copy are
optional arguments. See Below.
Karl Ropkins
Currently removing select, rename and summarise while
deciding how to respond to changes to tidyverse code...
fortify is used by ggplot2 functions
when these are used to plot data in a pems
dataset. Most users will never have to use this
directly.
The pems object methods select,
filter,
arrange, slice, mutate,
and group_by are similar
to data.frame methods of the same
names in dplyr, but (hopefully) they
also track units, etc, like a pems object.
Work in progress. See below, especially Note.
Equivalent underscore methods (select_, etc)
are also provided, although it should be noted that
they are probably going when dplyr drops
these.
Data joining methods include inner_join,
left_join, right_join, full_join,
semi_join and anti_join. Like above
these are similar data.frame equivalents in
dplyr, but (hopefully) also track units, etc,
like a pems object. Same 'work in progress' caveat.
See Note.
Generics in general:
H. Wickham. Advanced R. CRC Press, 2014.
(Not yet fully implemented within this package.)
ggplot2:
H. Wickham. ggplot2: elegant graphics for data analysis. Springer New York, 2009.
(See Chapter 9, section 9.3, pages 169-175, for discussion of fortify)
dplyr:
Hadley Wickham, Romain Francois, Lionel Henry and Kirill Muller (2020). dplyr: A Grammar of Data Manipulation. R package version 1.0.2. https://CRAN.R-project.org/package=dplyr