f.sampleSize: Calculate sample size of a study

View source: R/f_sampleSize.R

f.sampleSizeR Documentation

Calculate sample size of a study

Description

Trial concept calculated: sample size of the trial, preferring results-related (achieved recruitment) over protocol-related information (planned sample size). Thus, the calculated number depends on the status of the recruitment (see f.statusRecruitment) and on the availability of results data; for "CTIS", the number always corresponds to the planned sample size.

Usage

f.sampleSize(df = NULL)

Arguments

df

data frame such as from dbGetFieldsIntoDf. If 'NULL', prints fields needed in 'df' for calculating this trial concept, which can be used with dbGetFieldsIntoDf.

Value

data frame with columns '_id' and '.sampleSize', an integer.

Examples

# fields needed
f.sampleSize()

# apply trial concept when creating data frame
dbc <- nodbi::src_sqlite(
  dbname = system.file("extdata", "demo.sqlite", package = "ctrdata"),
  collection = "my_trials", flags = RSQLite::SQLITE_RO)
trialsDf <- dbGetFieldsIntoDf(
  calculate = "f.sampleSize",
  con = dbc)
trialsDf


ctrdata documentation built on Jan. 18, 2026, 9:07 a.m.