Print, summarise and coerce a longitudinal design schedule
Source:R/design_schedule.R
print.svyplan_schedule.Rdprint() states the issue profile as a run of takes rather than as one
row per occasion, because a schedule's occasions are mostly identical and
its length is set by the reporting horizon rather than by the design.
summary() gives the occasion-by-occasion tables: the issue profile in
full, the component activity, the overlap the rotation produces, and the
interviews owed after the horizon. as.data.frame() returns the issue
profile, and every table stays reachable as a field.
Usage
# S3 method for class 'svyplan_schedule'
print(x, ...)
# S3 method for class 'svyplan_schedule'
summary(object, ...)
# S3 method for class 'summary.svyplan_schedule'
print(x, ...)
# S3 method for class 'svyplan_schedule'
format(x, ...)
# S3 method for class 'svyplan_schedule'
as.data.frame(
x,
row.names = NULL,
optional = FALSE,
stringsAsFactors = FALSE,
validRN = TRUE,
...
)
# S3 method for class 'svyplan_schedule'
x$name <- value
# S3 method for class 'svyplan_schedule'
x[i] <- value
# S3 method for class 'svyplan_schedule'
x[[i]] <- valueArguments
- x
An
svyplan_schedule, or thesummary.svyplan_scheduleobjectsummary()returns.- ...
Additional arguments are not supported and produce an error.
- object
An
svyplan_schedule.- row.names, optional, stringsAsFactors, validRN
Standard
as.data.frame()arguments.- name, i, value
Standard replacement arguments for
$<-,[[<-, and[<-. These operations are refused because they would break reconciliation within the schedule object.
Value
print() returns its argument invisibly, summary() an object of
class summary.svyplan_schedule carrying the schedule and its four
tables, format() one descriptive string, and as.data.frame() the
issue profile.
Direct field and table replacement with $<-, [[<-, or [<- is refused
because the metadata and tables describe one reconciled design. Recompute
with design_schedule() to change the plan, or extract a table first to
modify a plain data frame.
See also
design_schedule(), which builds these objects, n_panel() for
the rotating plan they schedule, and print.svyplan_overlap() for the
rotation the life describes.
Examples
panel <- n_panel(
n_prop(p = 0.5, moe = 0.03),
retention = c(0.9, 0.9, 0.9),
resp_rate = 0.75,
design = "rotating",
start = "immediate"
)
schedule <- design_schedule(
panel,
design_rotation("4"),
horizon = 6,
horizon_policy = "continuing",
refreshment = "entrant_register",
rounding = "ceiling"
)
schedule
#> Longitudinal design schedule (immediate launch, continuing)
#> life: 4 stages over 6 occasions, steady from occasion 4
#> rounding: ceiling at panel and cohort level
#> issue: 1656 at startup, 414 per occasion (occasions 2-6)
#> tail commitments: 6 panel-interviews after occasion 6
#> # summary() for the occasion-by-occasion profile and the overlap
# the occasion-by-occasion tables the print block summarises
s <- summary(schedule)
s
#> Analysis of a longitudinal design schedule (immediate launch, continuing)
#>
#> life: 4 stages over 6 occasions, steady from occasion 4
#> rounding: ceiling at panel and cohort level
#> entrants: 414 per occasion, 1656 in sample across 4 cohorts
#> refreshment: entrant_register
#>
#> Issue profile
#> wave cohort planned_issue operational_issue steady_state
#> 1 startup 1654.856 1656 FALSE
#> 2 intake_2 413.714 414 FALSE
#> 3 intake_3 413.714 414 FALSE
#> 4 intake_4 413.714 414 TRUE
#> 5 intake_5 413.714 414 TRUE
#> 6 intake_6 413.714 414 TRUE
#>
#> Components
#> cohort entry_wave frame_role planned_issue operational_issue panels
#> startup 1 startup 1654.856 1656 4
#> intake_2 2 entrant_register 413.714 414 1
#> intake_3 3 entrant_register 413.714 414 1
#> intake_4 4 entrant_register 413.714 414 1
#> intake_5 5 entrant_register 413.714 414 1
#> intake_6 6 entrant_register 413.714 414 1
#> panel_issue
#> 414
#> 414
#> 414
#> 414
#> 414
#> 414
#>
#> Overlap the rotation produces
#> lag shared n_occasion overlap
#> 1 3 4 0.75
#> 2 2 4 0.50
#> 3 1 4 0.25
#> tail commitments: 6 panel-interviews after occasion 6
#> # $activity for the panel-level schedule, $tail_commitments for the tail
# every table stays reachable as a field
schedule$components
#> cohort entry_wave frame_role planned_issue operational_issue panels
#> 1 startup 1 startup 1654.856 1656 4
#> 2 intake_2 2 entrant_register 413.714 414 1
#> 3 intake_3 3 entrant_register 413.714 414 1
#> 4 intake_4 4 entrant_register 413.714 414 1
#> 5 intake_5 5 entrant_register 413.714 414 1
#> 6 intake_6 6 entrant_register 413.714 414 1
#> panel_issue frame_vintage status
#> 1 414 <NA> planned
#> 2 414 <NA> planned
#> 3 414 <NA> planned
#> 4 414 <NA> planned
#> 5 414 <NA> planned
#> 6 414 <NA> planned
schedule$tail_commitments
#> wave cohort panel life_stage life_length relative_take
#> 1 7 intake_4 1 4 4 1
#> 2 7 intake_5 1 3 4 1
#> 3 7 intake_6 1 2 4 1
#> 4 8 intake_5 1 4 4 1
#> 5 8 intake_6 1 3 4 1
#> 6 9 intake_6 1 4 4 1
# as.data.frame() returns the issue profile
as.data.frame(schedule)
#> wave cohort planned_issue operational_issue steady_state
#> 1 1 startup 1654.856 1656 FALSE
#> 2 2 intake_2 413.714 414 FALSE
#> 3 3 intake_3 413.714 414 FALSE
#> 4 4 intake_4 413.714 414 TRUE
#> 5 5 intake_5 413.714 414 TRUE
#> 6 6 intake_6 413.714 414 TRUE