Description Usage Arguments Details Value See Also Examples
Change "Intervals"
dimscales
to "Points"
,
replacing each interval with its midpoint. This can be useful for plotting
or calculating mean values, among other things. midpoints
is
typically called by other functions, but it may
sometimes be useful to call it directly.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | midpoints(object, dimension)
## S4 method for signature 'Component,ANY'
midpoints(object, dimension)
## S4 method for signature 'Component,missing'
midpoints(object)
## S4 method for signature 'DemographicArray,ANY'
midpoints(object, dimension)
## S4 method for signature 'DemographicArray,missing'
midpoints(object)
## S4 method for signature 'MetaData,integer'
midpoints(object, dimension)
## S4 method for signature 'Population,ANY'
midpoints(object, dimension)
## S4 method for signature 'Population,missing'
midpoints(object)
|
object |
Object of class |
dimension |
Names or indices of dimensions to be converted. If
omitted, all dimensions with dimtype |
An object can only have a dimension with dimtype
"triangle"
if the object also has age and time dimensions with
dimscale "Intervals"
. When midpoints
is called
on an object with a triangles dimension, the dimtype for that
dimension is coerced to "state"
and the dimscale is
coerced to "Categories"
.
Object of class DemographicArray
.
1 2 3 4 5 6 7 8 9 10 11 12 13 | library(demdata)
rates <- Values(VADeaths2)
midpoints(rates)
a <- array(1:4,
dim = c(2, 2),
dimnames = list(age = c("0-39", "40+"),
period = c("2001-2010", "2011-2020")))
x <- Counts(a)
midpoints(x)
midpoints(x, dimension = c("age", "period"))
midpoints(x, dimension = "period")
midpoints(x, dimension = 2)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.