Learn R Programming

tigerstats (version 0.1.6)

popsamp: Sampling From a Population

Description

Instructional function, and possibly a utility function for some apps.

Usage

popsamp(n,pop,...)

Arguments

n
number of items to sample
pop
data frame, from which to sample n rows
...
other arguments passed to function

Value

  • The sample, as a data frame.

Examples

Run this code
data(imagpop)
popsamp(10,imagpop)  #Simple random sampling (no replacement)
popsamp(10,imagpop,replace=TRUE)  #Random sampling with replacement

Run the code above in your browser using DataLab