calculateExpoParams: Calculate the mean and the variance of the exposure

Description Usage Arguments Value Examples

View source: R/varFrac.R

Description

Calculate the mean and the variance of the exposure

Usage

1
calculateExpoParams(df, pheno, expo)

Arguments

df

is the dataframe with the cohort information

pheno

is the studied outcome

expo

is the studied exposure

Value

A vector of length 2 which first element is the mean and second element is the variance

Examples

1
2
3
4
5
6
7
8
#Case where E is quantitative
datafr = data.frame(floor(rnorm(5,5000,2000)), runif(5,2.5,3), runif(5, 1.2, 1.4))
colnames(datafr) = c("pheno_N", "pheno_expo_Mean", "pheno_expo_SD")
params = calculateExpoParams(df = datafr, pheno = "pheno", expo = "expo")
#Case where E is binary
datafr = data.frame(floor(rnorm(5,5000,2000)), floor(runif(5,1000,3000)))
colnames(datafr) = c("pheno_N", "pheno_expo_P")
params = calculateExpoParams(df = datafr, pheno = "pheno", expo = "expo")

vincela/VarExp documentation built on May 29, 2019, 12:42 p.m.