make_my_data2L: Extract random subset of a dataframe

Description Usage Arguments Examples

Description

Currently only works with data with 2-levels. Notes that if the size of the dataframe is too small to accomodate n.sample then with.rep is set to TRUE.

Usage

1
2
make_my_data2L(dat, my.code = "nlb24", cat.var, n.sample = 20,
  with.rep = FALSE)

Arguments

dat

R dataframe to randomly subset

cat.var

Categorical variable by which to split the data up

n.sample

Number of samples per group to randomly select. 2*n.sample will be the total size of the dataframe.

with.rep

Should sampling be with replacement? If with.rep = TRUE then individuals can occur more than once within the dataframe.

mycode

Unique code, such as your email address. Must contain only letters and numbers and not the at symbol or other punctuation.

Examples

1
2
3
4
5
6
7
8
9
#Subset frogarms data
data(frogarms)
my.frogs <- make_my_data2L(dat = frogarms,
                           my.code = "nlb24",
                           cat.var = "sex",
                           n.sample = 20,
                           with.rep = FALSE)

summary(my.frogs)

brouwern/wildlifeR documentation built on May 28, 2019, 7:13 p.m.