addSampleSizes: Add sample sizes to "size" compositions in a dataframe

View source: R/addSampleSizes.R

addSampleSizesR Documentation

Add sample sizes to "size" compositions in a dataframe

Description

Function to add sample sizes to "size" compositions in a dataframe.

Usage

addSampleSizes(
  dfr,
  id.facs = NULL,
  id.size = "size",
  id.value = "N",
  dfrSS = NULL,
  id.ss = "ss",
  verbose = FALSE
)

Arguments

dfr

- input dataframe with composition data by "size" and other factors

id.facs

- character vector of column names used as factors in calculating the sample sizes (or NULL)

id.size

- name of column in dfr with "size" data

id.value

- name of column in dfr with count data

dfrSS

- previously calculated dataframe with sample sizes by "other factors" (or NULL)

id.ss

- name of column in dfrSS with sample sizes

verbose

- flag to print diagnostic output to console

Details

Non-standard column names SHOULD NOT be back-quoted. If dfrSS is provided, it will be used as the source of the sample size information (useful for appending modified sample sizes to size compositions); otherwise, "raw" sample sizes are calculated directly from dfr.

Value

dataframe with original size compositions and sample sizes in column "ss".


wStockhausen/wtsSizeComps documentation built on March 17, 2024, 3:09 p.m.