subset_replace | R Documentation |
demog_change_component_df
These are methods for the subset operators and their companion
replacement functions for objects of class
demog_change_component_df
. The return values differ and,
importantly, subsetting and subset-replacement do not return objects of class
demog_change_component_df
(see “Details”).
## S3 method for class 'demog_change_component_df' x[i, j, drop] ## S3 replacement method for class 'demog_change_component_df' x[i, j] <- value ## S3 replacement method for class 'demog_change_component_df' x$name <- value ## S3 replacement method for class 'demog_change_component_df' x[[i, j]] <- value ## S3 method for class 'demog_change_component_df' subset(x, ...)
x |
data frame. |
i |
elements to extract or replace. For |
j |
elements to extract or replace. For |
drop |
logical. If |
value |
A suitable replacement value: it will be repeated a whole
number of times if necessary and it may be coerced: see the
Coercion section. If |
name |
A literal character string or a name (possibly backtick quoted). |
... |
elements to extract or replace. For |
Arbitrary subsets or modifications of
demog_change_component_df
s (and objects of subclasses) may
not be valid members of the class. Therefore, the object resulting
from a subset operation via `[`
, or a replacement via
`[<-`
, and similar, will no longer inherit from class
demog_change_component_df
(or subclasses) and the attributes
specific to those classes will be lost.
To create a demog_change_component_df
object from a subset
call demog_change_component_df
explicitly (e.g.,
demog_change_component_df(x[x$time_start == 1960,])
). A
similar approach can be taken for subset-replacement. For an
alternative approach to simple subsetting on the demographic change
component dimensions see subset_time
and friends.
A data.frame
,
one-dimensional vector, or scalar depending on the dimensions
of the extracted values.
Mark Wheldon
demog_change_component_df
for class
definitions, link{subset_time}
and friends.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.