make_my_data2L: Extract random subset of a dataframe

Description Usage Arguments Examples

View source: R/make_my_data2L.R

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
3
4
5
6
7
make_my_data2L(
  dat,
  my.code = "nlb24",
  cat.var,
  n.sample = 20,
  with.rep = FALSE
)

Arguments

dat

R dataframe to randomly subset

my.code

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

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.

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/compbio4all documentation built on Dec. 19, 2021, 11:47 a.m.