popsamp: Sampling From a Population

Description Usage Arguments Value Author(s) Examples

Description

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

Usage

1
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.

Author(s)

Homer White hwhite0@georgetowncollege.edu

Examples

1
2
3
data(imagpop)
popsamp(10,imagpop)  #Simple random sampling (no replacement)
popsamp(10,imagpop,replace=TRUE)  #Random sampling with replacement

Example output

Loading required package: abd
Loading required package: nlme
Loading required package: lattice
Loading required package: grid
Loading required package: mosaic
Loading required package: dplyr

Attaching package: 'dplyr'

The following object is masked from 'package:nlme':

    collapse

The following objects are masked from 'package:stats':

    filter, lag

The following objects are masked from 'package:base':

    intersect, setdiff, setequal, union

Loading required package: ggformula
Loading required package: ggplot2

New to ggformula?  Try the tutorials: 
	learnr::run_tutorial("introduction", package = "ggformula")
	learnr::run_tutorial("refining", package = "ggformula")
Loading required package: mosaicData
Loading required package: Matrix

The 'mosaic' package masks several functions from core packages in order to add 
additional features.  The original behavior of these functions should not be affected by this.

Note: If you use the Matrix package, be sure to load it BEFORE loading mosaic.

Attaching package: 'mosaic'

The following object is masked from 'package:Matrix':

    mean

The following objects are masked from 'package:dplyr':

    count, do, tally

The following objects are masked from 'package:stats':

    IQR, binom.test, cor, cor.test, cov, fivenum, median, prop.test,
    quantile, sd, t.test, var

The following objects are masked from 'package:base':

    max, mean, min, prod, range, sample, sum

Welcome to tigerstats!
To learn more about this package, consult its website:
	http://homerhanumat.github.io/tigerstats
        sex math income cappun height idealheight diff kkardashtemp
868  female   no  49300 oppose   66.4          68  1.6           10
6404   male   no  13000 oppose   73.6          76  2.4           88
7372 female   no   8200 oppose   66.0          67  1.0            7
1358 female   no  89200 oppose   62.9          64  1.1            8
5177 female   no  46200  favor   62.0          64  2.0            2
5296   male   no   9700  favor   74.8          77  2.2           89
5209 female   no  57300  favor   62.4          64  1.6           32
7788   male   no  78800  favor   71.4          74  2.6           91
3827 female   no  33500 oppose   60.7          62  1.3            3
1873 female   no  57600 oppose   65.0          66  1.0            6
        sex math income cappun height idealheight diff kkardashtemp
9230 female   no  57300  favor   59.7          61  1.3            3
1852   male   no  38500 oppose   64.4          67  2.6           70
6548 female   no  15500 oppose   63.5          65  1.5           13
1433   male   no  45800  favor   69.2          72  2.8           99
1703   male   no  66600 oppose   70.0          73  3.0           93
3982   male   no 104400 oppose   76.0          79  3.0           71
512  female   no  11800 oppose   63.9          66  2.1           22
3637 female   no  26200 oppose   64.0          66  2.0            1
4538 female   no  26900  favor   68.2          70  1.8            6
8241 female   no  42600 oppose   67.9          69  1.1            7

tigerstats documentation built on July 2, 2020, 2:32 a.m.