| Title: | Randomly Select Samples for Various Probability-Based Methods |
|---|---|
| Description: | Randomly select samples using simple random sampling (SRS), systematic sampling, and various probability proportional to size (PPS) methods, including systematic PPS and sequential PPS (i.e., Chromy's method). Also includes functionality to allocate sample sizes across strata using proportional, power, Neyman, and optimal allocation methods, and to select samples within strata. Designed to make survey sample design and selection reproducible, efficient, and transparent for survey statisticians and researchers. Sampling methods follow Kalton (1983) <doi:10.4135/9781412984683> and Chromy (1979) <http://www.asasrms.org/Proceedings/papers/1979_081.pdf>. |
| Authors: | Stephanie Zimmer [aut, cre], John David Bunker, Jr. [aut], Thomas Burkett [aut], Philip Lee [aut], Haby Sow [aut], RTI International [cph, fnd] |
| Maintainer: | Stephanie Zimmer <[email protected]> |
| License: | GPL (>= 3) |
| Version: | 1.0.0 |
| Built: | 2026-09-14 08:29:15 UTC |
| Source: | https://github.com/rtiinternational/sampleselectr |
Compute the proportional, power, Neyman, and optimal sample allocations.
allocate( allocation, N.h, n.samp = NULL, S.h = NULL, c.h = NULL, cost = NULL, variance = NULL, power = NULL, lbound = 2, outputs = "rounded" )allocate( allocation, N.h, n.samp = NULL, S.h = NULL, c.h = NULL, cost = NULL, variance = NULL, power = NULL, lbound = 2, outputs = "rounded" )
allocation |
type of allocation, must be one of |
N.h |
vector of population stratum sizes ( |
n.samp |
total sample size to be allocated (positive integer of length 1). |
S.h |
vector of stratum unit standard deviations (positive values same length as |
c.h |
vector of cost per unit in stratum h (positive values same length as |
cost |
total variable cost (positive value) |
variance |
fixed variance target for estimated mean (positive value) ( |
power |
power value for power allocation ( |
lbound |
minimum stratum-level sample size (positive integer of length 1). Default value is 2. If N.h < lbound for a stratum, the sample size will be limited to N.h. |
outputs |
character vector representing whether to output:
Default is to only return the final rounded version [ |
If one output type is requested, a numeric vector of allocations. If multiple output types are requested, a named list containing the requested allocation vectors.
The allocate function allocates a sample size n on H strata using one of the following allocation methods:
Proportional allocation [n.samp, N.h, allocation = "proportional"]
where : total sample size to be allocated (function input is n.samp), and : population size of stratum h (function input is N.h).
Power allocation [n.samp, N.h, power, allocation = "power"]
where : a power value to control over-under-sampling with (function input is power).
Neyman allocation [n.samp, N.h, S.h, allocation = "neyman"]
where : standard deviation of stratum h (function input is S.h).
Optimal allocation
cost-constrained [N.h, S.h, c.h, cost, allocation = "optimal"]
where : cost per unit in stratum h (function input is c.h), and : total variable cost (function input is cost)
precision-constrained [N.h, S.h, c.h, variance, allocation = "optimal"]
where : fixed variance target for estimated mean (function input is variance)
The table below presents the relevant inputs for each type; when irrelevant inputs are entered, an error message will be displayed.
| allocation | N.h | n.samp | S.h | c.h | cost | variance | lbound | power |
| proportional | X | X | X | |||||
| power | X | X | X | X | ||||
| neyman | X | X | X | X | ||||
| optimal: cost-constrained | X | X | X | X | X | |||
| optimal: precision-constrained | X | X | X | X | X |
# The first step is getting a frame summary # Summarize the IPEDS dataset by OBEREG # - N: number of universities per region # - SD_ENRTOT: standard deviation of total enrollment per region # - Filter out rows with missing ENRTOT to ensure accurate variance estimates ipeds_summary <- ipeds |> tidytable::filter(!is.na(ENRTOT)) |> tidytable::group_by(OBEREG) |> tidytable::summarize( N = tidytable::n(), SD_ENRTOT = stats::sd(ENRTOT) ) |> tidytable::ungroup() # Example of proportional allocation ipeds_summary |> tidytable::mutate( n = allocate("proportional", N.h = N, n.samp = 500) ) # Example of power allocation ipeds_summary |> tidytable::mutate( n = allocate("power", N.h = N, power = 0.5, n.samp = 500) ) # Example of Neyman allocation ipeds_summary |> tidytable::mutate( n = allocate("neyman", N.h = N, n.samp = 500, S.h = SD_ENRTOT) ) # Example of Neyman allocation with a lower bound of 5 ipeds_summary |> tidytable::mutate( n = allocate("neyman", N.h = N, n.samp = 500, S.h = SD_ENRTOT, lbound = 5) )# The first step is getting a frame summary # Summarize the IPEDS dataset by OBEREG # - N: number of universities per region # - SD_ENRTOT: standard deviation of total enrollment per region # - Filter out rows with missing ENRTOT to ensure accurate variance estimates ipeds_summary <- ipeds |> tidytable::filter(!is.na(ENRTOT)) |> tidytable::group_by(OBEREG) |> tidytable::summarize( N = tidytable::n(), SD_ENRTOT = stats::sd(ENRTOT) ) |> tidytable::ungroup() # Example of proportional allocation ipeds_summary |> tidytable::mutate( n = allocate("proportional", N.h = N, n.samp = 500) ) # Example of power allocation ipeds_summary |> tidytable::mutate( n = allocate("power", N.h = N, power = 0.5, n.samp = 500) ) # Example of Neyman allocation ipeds_summary |> tidytable::mutate( n = allocate("neyman", N.h = N, n.samp = 500, S.h = SD_ENRTOT) ) # Example of Neyman allocation with a lower bound of 5 ipeds_summary |> tidytable::mutate( n = allocate("neyman", N.h = N, n.samp = 500, S.h = SD_ENRTOT, lbound = 5) )
Draws a sequential sample of size n. Each unit's probability of selection is proportional to its size measure. This is a minimum replacement method as discussed in Chromy (1979).
chromy_pps(frame, n, mos, outall = FALSE, curstrat = NULL)chromy_pps(frame, n, mos, outall = FALSE, curstrat = NULL)
frame |
The input data frame for the function to work on. |
n |
The sample size, the parameter expects an integer of length 1. The function will check if n is less than or equal to the number of rows in the input frame. |
mos |
The measure of size, the parameter expects a character string to indicate the variable to be used as the measure of size. The variable must exist on the frame and be a non-missing and non-negative numeric variable. |
outall |
Output all records or selected records. If outall is TRUE, then all records are returned and the following variables are created: SelectionIndicator, SamplingWeight, NumberHits, and ExpectedHits. If outall is FALSE, then the selected records are returned and the following variables are created: SamplingWeight, NumberHits, ExpectedHits. |
curstrat |
A character variable that specifies the current strata, only used as an assertion for the n == N test. |
Returns an object of type tidytable that contains the weight, expected hits (selection probability for nonreplacement designs), and number of hits plus all original variables. Include a SelectionIndicator variable if outall=TRUE
Chromy, J. R. (1979). “Sequential Sample Selection Methods.” In Proceedings of the Survey Research Methods Section, 401–406. Washington, DC: American Statistical Association. http://www.asasrms.org/Proceedings/papers/1979_081.pdf
# PPS sample of counties using population size as MOS # LA county will be selected two or three times based on expected hits # Cook, Harris, and Maricopa will be selected one or two times based on expected hits county_2023 |> tidytable::select(GEOID, Name, Pop_Tot) |> chromy_pps(n = 75, mos = "Pop_Tot") |> tidytable::arrange(desc(ExpectedHits)) county_2023 |> tidytable::select(GEOID, Name, Pop_Tot) |> chromy_pps(n = 75, mos = "Pop_Tot", outall = TRUE) |> tidytable::arrange(desc(ExpectedHits))# PPS sample of counties using population size as MOS # LA county will be selected two or three times based on expected hits # Cook, Harris, and Maricopa will be selected one or two times based on expected hits county_2023 |> tidytable::select(GEOID, Name, Pop_Tot) |> chromy_pps(n = 75, mos = "Pop_Tot") |> tidytable::arrange(desc(ExpectedHits)) county_2023 |> tidytable::select(GEOID, Name, Pop_Tot) |> chromy_pps(n = 75, mos = "Pop_Tot", outall = TRUE) |> tidytable::arrange(desc(ExpectedHits))
A select set of estimates from the ACS for all counties in the 50 states and District of Columbia.
county_2023county_2023
A tibble/data.frame with 3,144 rows and 25 columns:
Geographic Identifier (GEOID) of county (character)
Name of county (character)
State (Abbreviation) (character)
Census Region (factor)
Census Division (factor)
Total population (B03002) (numeric)
Percent of population who is White alone, non-Hispanic (B03002) (numeric)
Percent of population who is Black or African American alone, non-Hispanic (B03002) (numeric)
Percent of population who is American Indian and Alaska Native alone, non-Hispanic (B03002) (numeric)
Percent of population who is Asian alone, non-Hispanic (B03002) (numeric)
Percent of population who is Native Hawaiian and Other Pacific Islander alone, non-Hispanic (B03002) (numeric)
Percent of population who is another race (including 2 or more races), non-Hispanic (B03002) (numeric)
Percent of population who is Hispanic (B03002) (numeric)
Total number of housing units (B25002) (numeric)
Percent of housing units that are occupied (B25002) (numeric)
Percent of housing units that are vacant (B25002) (numeric)
Percent of population that are 0-4 years of age (S0101) (numeric)
Percent of population that are 5-9 years of age (S0101) (numeric)
Percent of population that are 10-14 years of age (S0101) (numeric)
Percent of population that are 15-17 years of age (S0101) (numeric)
Percent of population that are 18-24 years of age (S0101) (numeric)
Percent of population that are 25-44 years of age (S0101) (numeric)
Percent of population that are 45-64 years of age (S0101) (numeric)
Percent of population that are 65-74 years of age (S0101) (numeric)
Percent of population that are 75 years of age or older (S0101) (numeric)
U.S. Census Bureau, "American Community Survey 5-Year Estimates" 2023, https://api.census.gov/data/2023/acs/acs5, accessed on May 30, 2025. Tables B03002, B25002, and S0101. Note - the tidycensus package was used to download the data from the Census API. Region and division are coded based on https://www2.census.gov/geo/pdfs/maps-data/maps/reference/us_regdiv.pdf
A select set of characteristics for postsecondary educational institutions from the Integrated Postsecondary Education Data System (IPEDS) for operational institutions reporting fall enrollment data for 2023.
ipedsipeds
A tibble with 5914 rows and 16 columns:
Unique identification number of the institution (numeric)
Institution (entity) name (character)
State abbreviation (character)
FIPS state code (numeric)
Bureau of Economic Analysis (BEA) regions (factor)
Level of institution (factor)
Sector of institution (factor)
Degree of urbanization (Urban-centric locale) (factor)
Degree-granting status (factor)
Highest level of offering (factor)
Total enrollment (numeric)
Undergraduate enrollment (numeric)
First-time degree/certificate-seeking undergraduate enrollment (numeric)
Full-time undergraduate enrollment (numeric)
Graduate enrollment (numeric)
Full-time graduate enrollment (numeric)
National Center for Education Statistics, "Integrated Postsecondary Education Data System " 2023, https://nces.ed.gov/ipeds/datacenter/DataFiles.aspx?year=2023&surveyNumber=-1&sid=4737d338-5121-4355-bb91-01ffa92243ef&rtid=7, downloaded on May 2, 2025.
A select set of estimates from the ACS for all PUMAs in the 50 states and District of Columbia.
puma_2023puma_2023
A tibble/data.frame with 2,462 rows and 25 columns:
Geographic Identifier (GEOID) of PUMA (character)
Name of PUMA (character)
State (Abbreviation) (character)
Census Region (factor)
Census Division (factor)
Total population (B03002) (numeric)
Percent of population who is White alone, non-Hispanic (B03002) (numeric)
Percent of population who is Black or African American alone, non-Hispanic (B03002) (numeric)
Percent of population who is American Indian and Alaska Native alone, non-Hispanic (B03002) (numeric)
Percent of population who is Asian alone, non-Hispanic (B03002) (numeric)
Percent of population who is Native Hawaiian and Other Pacific Islander alone, non-Hispanic (B03002) (numeric)
Percent of population who is another race (including 2 or more races), non-Hispanic (B03002) (numeric)
Percent of population who is Hispanic (B03002) (numeric)
Total number of housing units (B25002) (numeric)
Percent of housing units that are occupied (B25002) (numeric)
Percent of housing units that are vacant (B25002) (numeric)
Percent of population that are 0-4 years of age (S0101) (numeric)
Percent of population that are 5-9 years of age (S0101) (numeric)
Percent of population that are 10-14 years of age (S0101) (numeric)
Percent of population that are 15-17 years of age (S0101) (numeric)
Percent of population that are 18-24 years of age (S0101) (numeric)
Percent of population that are 25-44 years of age (S0101) (numeric)
Percent of population that are 45-64 years of age (S0101) (numeric)
Percent of population that are 65-74 years of age (S0101) (numeric)
Percent of population that are 75 years of age or older (S0101) (numeric)
U.S. Census Bureau, "American Community Survey 5-Year Estimates" 2023, https://api.census.gov/data/2023/acs/acs5, accessed on May 30, 2025. Tables B03002, B25002, and S0101. Note - the tidycensus package was used to download the data from the Census API. Region and division are coded based on https://www2.census.gov/geo/pdfs/maps-data/maps/reference/us_regdiv.pdf
Selects a random sample using a specified method and sample size. Selection can also optionally be stratified and/or include a measure of size (mos) if a PPS method is used.
select_sample( frame, method, n, outall = FALSE, strata = NULL, mos = NULL, sort_vars = NULL, sort_method = NULL )select_sample( frame, method, n, outall = FALSE, strata = NULL, mos = NULL, sort_vars = NULL, sort_method = NULL )
frame |
A data frame, data.table, or tibble from which to draw the sample. No default. |
method |
The desired sampling method. Valid options are "srs", "sys_eq", "sys_pps", and "chromy_pps". No default. |
n |
The sample size to draw from the frame. If strata is NULL, must be a positive integer. If strata is not NULL, must be a
data.frame, tibble, or data.table with columns for each stratification variable as the same type and variable names as the frame
plus a column with the sample size ( |
outall |
A logical value indicating whether to return the entire frame with a selection indicator or just the sample. Default is FALSE. |
strata |
A vector of characters with variable names of strata. Default is NULL. |
mos |
A character string defining the variable name on the frame for the measure of size. If not NULL, must have method = c("sys_pps", "chromy_pps"). If NULL, must have method=c("srs", "sys"). Default is NULL. |
sort_vars |
A vector of characters indicating the variables that should be used to sort the frame. If not NULL, cannot have method = "srs". Default is NULL. |
sort_method |
A character string defining the method to implicitly sort the frame. Valid options are "serpentine" and "nest". Must coincide with sort_var; i.e., both must be NULL or both must be not NULL. Default is NULL. |
A tidytable object containing the entire frame with a selection indicator or just the sample, dependent on the value of outall. Selection probability and sampling weight are also included. May include various summary messages to the console when applicable for certain sampling methods.
# SRS of 100 US counties, using geographic region as strata # n is a data frame containing the strata values and corresponding desired sample size # Sample size column must be titled 'sample_size' n_df_srs <- data.frame( Region = as.factor(c("Northeast", "Midwest", "South", "West")), sample_size = c(25, 25, 25, 25) ) county_2023 |> select_sample(method = "srs", n = n_df_srs, strata = "Region") # Systematic sample of 250 US universities. Each unit has an equal probability of being selected # Includes a nested sort of enrollment total within sector # Returns all obs from original data frame with a selection indicator column sample_sys_eq <- ipeds |> select_sample( method = "sys_eq", n = 250, outall = TRUE, sort_vars = c("SECTOR", "ENRTOT"), sort_method = "nest" ) # For samples taken with outall = TRUE, the sample size can be verified by summing # the SelectionIndicator column. sample_sys_eq sum(sample_sys_eq$SelectionIndicator) # Systematic PPS sample of 250 US universities. Each unit's probability of selection # is proportional to its size measure. # Using enrollment total as MOS # Includes a nested sort of enrollment total within sector sample_sys_pps <- ipeds |> select_sample( method = "sys_pps", n = 250, mos = "ENRTOT", sort_vars = c("SECTOR", "ENRTOT"), sort_method = "nest" ) # For pps samples, it is possible for a single sampling unit to be selected multiple times # due to a large mos value. This is especially true as desired sample size increases. The # result is the final sample may not meet the desired sample size. To verify the pps sample, # the NumberHits column can be summed and should total to the desired sample size. sample_sys_pps sum(sample_sys_pps$NumberHits) # Sequential aka Chromy's method PPS sample of 500 PUMAs, using geographic region as strata # Includes a serpentine sort of geographic division then state # Using population total as MOS, each unit's probability of selection is proportional to its # size measure. # Note that there may be a discrepancy between the desired and final sample sizes. The final # sample size can be verified by totaling NumberHits. n_df_chr <- data.frame( Region = as.factor(c("Northeast", "Midwest", "South", "West")), sample_size = c(125, 125, 125, 125) ) puma_2023 |> select_sample( method = "chromy_pps", n = n_df_chr, strata = "Region", mos = "Pop_Tot", sort_vars = c("Division", "State"), sort_method = "serpentine" )# SRS of 100 US counties, using geographic region as strata # n is a data frame containing the strata values and corresponding desired sample size # Sample size column must be titled 'sample_size' n_df_srs <- data.frame( Region = as.factor(c("Northeast", "Midwest", "South", "West")), sample_size = c(25, 25, 25, 25) ) county_2023 |> select_sample(method = "srs", n = n_df_srs, strata = "Region") # Systematic sample of 250 US universities. Each unit has an equal probability of being selected # Includes a nested sort of enrollment total within sector # Returns all obs from original data frame with a selection indicator column sample_sys_eq <- ipeds |> select_sample( method = "sys_eq", n = 250, outall = TRUE, sort_vars = c("SECTOR", "ENRTOT"), sort_method = "nest" ) # For samples taken with outall = TRUE, the sample size can be verified by summing # the SelectionIndicator column. sample_sys_eq sum(sample_sys_eq$SelectionIndicator) # Systematic PPS sample of 250 US universities. Each unit's probability of selection # is proportional to its size measure. # Using enrollment total as MOS # Includes a nested sort of enrollment total within sector sample_sys_pps <- ipeds |> select_sample( method = "sys_pps", n = 250, mos = "ENRTOT", sort_vars = c("SECTOR", "ENRTOT"), sort_method = "nest" ) # For pps samples, it is possible for a single sampling unit to be selected multiple times # due to a large mos value. This is especially true as desired sample size increases. The # result is the final sample may not meet the desired sample size. To verify the pps sample, # the NumberHits column can be summed and should total to the desired sample size. sample_sys_pps sum(sample_sys_pps$NumberHits) # Sequential aka Chromy's method PPS sample of 500 PUMAs, using geographic region as strata # Includes a serpentine sort of geographic division then state # Using population total as MOS, each unit's probability of selection is proportional to its # size measure. # Note that there may be a discrepancy between the desired and final sample sizes. The final # sample size can be verified by totaling NumberHits. n_df_chr <- data.frame( Region = as.factor(c("Northeast", "Midwest", "South", "West")), sample_size = c(125, 125, 125, 125) ) puma_2023 |> select_sample( method = "chromy_pps", n = n_df_chr, strata = "Region", mos = "Pop_Tot", sort_vars = c("Division", "State"), sort_method = "serpentine" )
Sorts the rows in a given data frame in a hierarchical fashion given a list of variables (...)
serp_sort(.data, ..., naorder = TRUE, sortID = FALSE)serp_sort(.data, ..., naorder = TRUE, sortID = FALSE)
.data |
A data frame. No default. |
... |
Variables to sort by - must be listed as character variables. No default. |
naorder |
Logical value for whether to put NA values at the end of the sorted data frame. Default value is TRUE and treats NA values as the largest values when sorting. A value of FALSE treats NA Values as the smallest values when sorting. |
sortID |
Logical value that indicates whether the sort group information used to implement the sorting should be added to .data. By default, sort group is FALSE which means the sort group information is not added to .data. When TRUE, and there are k variables to sort by, a set of k-1 sort group variables with names sortSerpj (j=1 to k-1) are added to .data. |
A copy of .data that is hierarchically sorted and, if specified, includes the sort group variables created for sorting
# Sort counties by Region, then Division, in a serpentine pattern county_2023 |> serp_sort("Region", "Division") # Keep the intermediate sort-group columns (sortSerp1, sortSerp2) county_2023 |> serp_sort("Region", "Division", sortID = TRUE)# Sort counties by Region, then Division, in a serpentine pattern county_2023 |> serp_sort("Region", "Division") # Keep the intermediate sort-group columns (sortSerp1, sortSerp2) county_2023 |> serp_sort("Region", "Division", sortID = TRUE)
Draws a simple random sample of size n.
srs(frame, n, outall = FALSE, curstrat = NULL)srs(frame, n, outall = FALSE, curstrat = NULL)
frame |
A data frame, data.table, or tibble from which to draw the sample. No default. |
n |
The sample size to draw from the frame. Must be a positive integer. No default. |
outall |
A logical value indicating whether to return the entire frame with a selection indicator or just the sample. Default is FALSE. |
curstrat |
A character string indicating the current stratum. Used only for printing messages when n = N. Default is NULL. |
A tidytable object containing the entire frame with a selection indicator or just the sample, dependent on the value of outall. Selection probability and sampling weight are also included. The sample size, n, and the population size, N, are printed to the console.
# Random sample of 200 universities, only sampled rows returned ipeds |> tidytable::filter(!is.na(ENRTOT)) |> srs(n = 200, outall = FALSE) # Return full dataset with selection indicators ipeds |> tidytable::filter(!is.na(ENRTOT)) |> srs(n = 200, outall = TRUE)# Random sample of 200 universities, only sampled rows returned ipeds |> tidytable::filter(!is.na(ENRTOT)) |> srs(n = 200, outall = FALSE) # Return full dataset with selection indicators ipeds |> tidytable::filter(!is.na(ENRTOT)) |> srs(n = 200, outall = TRUE)
Draws a systematic sample of size n from a data frame. Each unit has an equal probability of being selected.
sys(frame, n, curstrat = NULL, outall = FALSE)sys(frame, n, curstrat = NULL, outall = FALSE)
frame |
a |
n |
Integer. The desired sample size. Must be less than or equal to the number of rows in |
curstrat |
Character or NULL. Optional stratum name for printing messages. |
outall |
logical indicator for whether full frame is returned or just the sample |
a data.table with the original columns plus:
Equal to n / N for all units.
Equal to N / n for all units.
TRUE if selected, FALSE otherwise.-only included if outall=TRUE
1 if selected, 0 otherwise.
Equal to SelectionProbability.
Kalton, G. (1983). Introduction to Survey Sampling. SAGE Publications. https://doi.org/10.4135/9781412984683
# Sort by REGION, DIVISION, and Pop_Tot, then take a sample puma_2023 |> tidytable::arrange(Region, Division, Pop_Tot) |> sys(n = 50, outall = FALSE) # Return full dataset with selection indicators puma_2023 |> tidytable::arrange(Region, Division, Pop_Tot) |> sys(n = 50, outall = TRUE)# Sort by REGION, DIVISION, and Pop_Tot, then take a sample puma_2023 |> tidytable::arrange(Region, Division, Pop_Tot) |> sys(n = 50, outall = FALSE) # Return full dataset with selection indicators puma_2023 |> tidytable::arrange(Region, Division, Pop_Tot) |> sys(n = 50, outall = TRUE)
Draws a systematic sample of size n. Each unit's probability of selection is proportional to its size measure.
sys_pps(frame, n, mos, outall = FALSE, curstrat = NULL)sys_pps(frame, n, mos, outall = FALSE, curstrat = NULL)
frame |
The input data frame for the function to work on. |
n |
The sample size, the parameter expects an integer of length 1. The function will check if n is less than or equal to the number of rows in the input frame. |
mos |
The measure of size, the parameter expects a character string to indicate the variable to be use as the measure of size. The variable must exists on the frame and be non-missing and non-negative numeric variable. |
outall |
Output all records or selected records. If outall is TRUE, then all records are return and the following variables are created: SelectionIndicator, SamplingWeight, NumberHits, and ExpectedHits. If outall is FALSE, then the selected records are return and the following variables are created: SamplingWeight, NumberHits, ExpectedHits. |
curstrat |
A character variable that specifies the current strata, only used as an assertion for the n == N test. |
Returns an object of type tidytable that contains the weight, selection probability, number of hits, etc plus all original variables.
# PPS sample of 75 counties using Pop_Tot as the measure of size # Return only the sampled counties sys_pps(county_2023, mos = "Pop_Tot", n = 75, outall = FALSE) # Return the full dataset with selection indicators sys_pps(county_2023, mos = "Pop_Tot", n = 75, outall = TRUE)# PPS sample of 75 counties using Pop_Tot as the measure of size # Return only the sampled counties sys_pps(county_2023, mos = "Pop_Tot", n = 75, outall = FALSE) # Return the full dataset with selection indicators sys_pps(county_2023, mos = "Pop_Tot", n = 75, outall = TRUE)