Coerce multisite simulation data to a plain tibble
Source:R/class-multisitedgp_data.R
as_tibble.multisitedgp_data.RdStrip the multisitedgp_data class and attributes (design,
diagnostics, provenance) and return a plain tbl_df. Useful when
handing off to a downstream tool that should not see the
multisiteDGP attributes.
Usage
# S3 method for class 'multisitedgp_data'
as_tibble(x, ..., .preserve_class = FALSE)
# S3 method for class 'multisitedgp_data'
x[i, j, ..., drop = FALSE]Arguments
- x
A
multisitedgp_dataobject.- ...
Passed to
as_tibble.- .preserve_class
Logical. If
TRUE, returnxunchanged (preserves the class and attributes). DefaultFALSE.- i, j
Row and column indices passed to base subsetting.
- drop
Included for base subsetting compatibility; multisiteDGP data objects use tibble-style non-dropping behavior.
Value
A plain tbl_df (with class and attributes stripped) unless
.preserve_class = TRUE, in which case x is returned unchanged.
Functions
[: Subset data while preserving class only when canonical columns remain; row subsets drop stale diagnostics.
See also
adapters for downstream package-specific
coercions (as_metafor, as_baggr, as_multisitepower).
Other family-design:
design_grid(),
is_multisitedgp_data(),
is_multisitedgp_design(),
multisitedgp_design(),
print.multisitedgp_data(),
summary.multisitedgp_data(),
update_multisitedgp_design(),
validate_multisitedgp_design()
Examples
dat <- sim_multisite(J = 10L, seed = 1L)
plain <- tibble::as_tibble(dat)
attributes(plain) # only standard tibble attributes
#> $names
#> [1] "site_index" "z_j" "tau_j" "tau_j_hat" "se_j"
#> [6] "se2_j" "n_j"
#>
#> $row.names
#> [1] 1 2 3 4 5 6 7 8 9 10
#>
#> $class
#> [1] "tbl_df" "tbl" "data.frame"
#>