as_disag.data.frame: Checks if a given dataframe is in the correct format for...

as_disag.data.frameR Documentation

Checks if a given dataframe is in the correct format for agouti functions

Description

Checks if a given dataframe is in the correct format for agouti functions

Usage

## S3 method for class 'data.frame'
as_disag(data, data2 = NULL, response_var, ...)

Arguments

data

A dataframe containing a outcome variable and ID variable named ID

data2

A dataframe default is NULL in which case we check the data is already in the correct format. If not null, the second data frame should contain predictor variables at a different resolution to the outcome but with the same linking ID variable

response_var

The name of the variable containing the response data

...

any other arguments

Value

as_disag.data.frame returns a dataframe that can be used with all agouti functions.

Examples

## Not run: 
disag_data <- as_disag(data=df_outcome, data2=df_predictor, outcome="Death")

## End(Not run)
data(madagascar_malaria)
disag_data <- as_disag(data=madagascar_malaria,response_var="case_rate")

timcdlucas/agouti documentation built on Feb. 8, 2024, 6:12 p.m.