Learn R Programming

tigerstats (version 0.3.2)

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
# NOT RUN {
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