This method ensures that the tbl_sample class is only preserved when the essential column (.weight) is still present. Operations like summarise() or count() that remove this column will return a regular tibble instead.
Usage
# S3 method for class 'tbl_sample'
dplyr_reconstruct(data, template)Details
Operations that change the number of rows (filtering, joins that
drop or duplicate rows) keep the class but mark the sample as
modified: the stored design then no longer describes the data, so
design-based computations (as_svydesign(), joint_expectation(),
design_effect()) refuse the sample and point to survey-side
domain analysis instead. Dropping an internal design column
(for example select() without .fpc_1) is marked the same way,
because the export would silently change (a missing FPC column
falls back to no finite population correction). Reordering rows,
reordering columns, and adding ordinary data columns are harmless
and are not marked.