Description Usage Arguments Details See Also Examples
Merge intervals within a dimension of a DemographicArray
object. The dimension must have dimscale
"Intervals"
.
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 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 | collapseIntervals(
object,
dimension,
breaks = NULL,
width = NULL,
old = NULL,
weights,
...
)
## S4 method for signature 'Counts,ANY,numeric,missing,missing,missing'
collapseIntervals(
object,
dimension,
breaks = NULL,
width = NULL,
old = NULL,
weights
)
## S4 method for signature 'Counts,ANY,numeric,'NULL','NULL',missing'
collapseIntervals(
object,
dimension,
breaks = NULL,
width = NULL,
old = NULL,
weights
)
## S4 method for signature 'Counts,ANY,missing,numeric,missing,missing'
collapseIntervals(
object,
dimension,
breaks = NULL,
width = NULL,
old = NULL,
weights
)
## S4 method for signature 'Counts,ANY,'NULL',numeric,'NULL',missing'
collapseIntervals(
object,
dimension,
breaks = NULL,
width = NULL,
old = NULL,
weights
)
## S4 method for signature 'Counts,ANY,missing,missing,character,missing'
collapseIntervals(
object,
dimension,
breaks = NULL,
width = NULL,
old = NULL,
weights
)
## S4 method for signature 'Counts,ANY,'NULL','NULL',character,missing'
collapseIntervals(
object,
dimension,
breaks = NULL,
width = NULL,
old = NULL,
weights
)
## S4 method for signature 'Counts,ANY,missing,missing,numeric,missing'
collapseIntervals(
object,
dimension,
breaks = NULL,
width = NULL,
old = NULL,
weights
)
## S4 method for signature 'Counts,ANY,'NULL','NULL',numeric,missing'
collapseIntervals(
object,
dimension,
breaks = NULL,
width = NULL,
old = NULL,
weights
)
## S4 method for signature 'Counts,ANY,ANY,ANY,ANY,Counts'
collapseIntervals(
object,
dimension,
breaks = NULL,
width = NULL,
old = NULL,
weights
)
## S4 method for signature 'Values,ANY,ANY,ANY,ANY,ANY'
collapseIntervals(
object,
dimension,
breaks = NULL,
width = NULL,
old = NULL,
weights
)
|
object |
Object of class |
dimension |
Name or index of the dimension where the intervals are found. |
breaks |
Numeric vector giving the breaks between intervals after the merging has occurred. |
width |
The length of the intervals after the merging has occurred. |
old |
The labels of the intervals to be merged. |
weights |
Object of class |
... |
Not currently used. |
Only one of breaks
, width
, and old
should be supplied.
breaks
must be a subset of the current breaks between intervals. The
first and last breaks can be omitted, as these are always retained by
collapseIntervals
.
width
is a shortcut version of breaks
for the common case
where all of the collapsed intervals will have the same width (apart from
any open intervals). It is equivalent to setting breaks equal to
seq(from = a, to = b, by = width)
where a
is the lowest
(finite) break in dimension
, and b
is the highest.
old
allows intervals to be identified by their labels, as with
collapseCategories
. Unlike with
collapseCategories
, however, no new
argument is
required (since it can be deduced from old
, and the elements of
old
must be consecutive.
If weights
equals 1
, all cells are receive equal weights.
collapseCategories
, collapseIterations
,
collapseOrigDest
, collapseDimension
,
dimscales
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 | library(demdata)
popn <- Counts(VAPopn)
collapseIntervals(popn, dimension = "age", breaks = c(50, 60, 70, 75))
## same results if first and last breaks omitted
collapseIntervals(popn, dimension = "age", breaks = c(60, 70))
## won't work since distance between first and last breaks
## not divisible by 10
## Not run:
collapseIntervals(popn, dimension = "age", width = 10)
## End(Not run)
## works if last age group omitted
popn.trunc <- subarray(popn, age < 70)
collapseIntervals(popn.trunc, dimension = "age", width = 10)
## selection via labels
collapseIntervals(popn, dimension = "age", old = c("60-64", "65-69", "70-74"))
## weights needed when collapsing objects of class "Values"
rates <- Values(VADeaths2)
collapseIntervals(rates, dimension = "age", breaks = 65, weights = popn)
collapseIntervals(rates, dimension = "age", breaks = 65, weights = 1)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.