sampling: Simple random sampling

View source: R/sampling.R

samplingR Documentation

Simple random sampling

Description

Simple random sampling

Usage

sampling(
  dataset,
  vars,
  sample_size,
  seed = 1234,
  data_filter = "",
  arr = "",
  rows = NULL,
  na.rm = FALSE,
  envir = parent.frame()
)

Arguments

dataset

Dataset to sample from

vars

The variables to sample

sample_size

Number of units to select

seed

Random seed to use as the starting point

data_filter

Expression entered in, e.g., Data > View to filter the dataset in Radiant. The expression should be a string (e.g., "price > 10000")

arr

Expression to arrange (sort) the data on (e.g., "color, desc(price)")

rows

Rows to select from the specified dataset

na.rm

Remove rows with missing values (FALSE or TRUE)

envir

Environment to extract data from

Details

See https://radiant-rstats.github.io/docs/design/sampling.html for an example in Radiant

Value

A list of class 'sampling' with all variables defined in the sampling function

See Also

summary.sampling to summarize results

Examples

sampling(rndnames, "Names", 10)


radiant-rstats/radiant.design documentation built on Jan. 19, 2024, 12:34 p.m.