A svyplan_rotation from design_rotation() is a numeric vector of takes,
one entry per occasion of a unit's life. as.double() gives that vector
bare, and as.data.frame() gives it one row per occasion.
Usage
# S3 method for class 'svyplan_rotation'
print(x, ...)
# S3 method for class 'svyplan_rotation'
format(x, ...)
# S3 method for class 'svyplan_rotation'
as.double(x, ...)
# S3 method for class 'svyplan_rotation'
as.data.frame(
x,
row.names = NULL,
optional = FALSE,
stringsAsFactors = FALSE,
validRN = TRUE,
...
)Arguments
- x
A
svyplan_rotationobject.- ...
Additional arguments are not supported and produce an error.
- row.names, optional, stringsAsFactors, validRN
Standard
as.data.frame()arguments.
Value
The method-specific result:
print()Returns
xinvisibly.format()Returns a string.
as.double()Returns the take vector.
as.data.frame()Returns one row per occasion, with
occasion,in_sampleandtake.
See also
design_rotation(), which builds these objects, and
design_overlap() for the lag profile one produces.
Examples
cps <- design_rotation("4-8-4")
cps
#> Rotation pattern (planning)
#>
#> 16-occasion life, 8 in sample each occasion
#> rotation: 4 in, 8 out, 4 in
as.double(cps)
#> [1] 1 1 1 1 0 0 0 0 0 0 0 0 1 1 1 1
as.data.frame(design_rotation("1-1-0-0-1-1"))
#> occasion in_sample take
#> 1 1 TRUE 1
#> 2 2 TRUE 1
#> 3 3 FALSE 0
#> 4 4 FALSE 0
#> 5 5 TRUE 1
#> 6 6 TRUE 1