Learn R Programming

statpsych (version 1.7.0)

random.sample: Generate a random sample

Description

Generates a random sample of participant IDs without replacement.

Usage

random.sample(popsize, samsize)

Value

Returns a vector of randomly generated participant IDs

Arguments

popsize

study population size

samsize

sample size

Examples

Run this code
random.sample(3000, 25)

# Should return:
#  [1]   37   94  134  186  212  408  485  697  722  781  998 1055 
# [13] 1182 1224 1273 1335 1452 1552 1783 1817 2149 2188 2437 2850 2936
 

Run the code above in your browser using DataLab