Learn R Programming

eVCGsampler (version 0.9.2)

combine_data: Combine data from pool and treated groups

Description

If your data is stored in separate files, you can use this function to merge them.

Usage

combine_data(POOL_data, TG_data, indicator_name = "treated")

Value

Data frame with all covariates that were present in both files and with new indicator factor POOL vs TG

Arguments

POOL_data

Data frame with POOL data, where you want to sample from.

TG_data

Data frame with TG (treated groups) data, all treated groups together!

indicator_name

Name of the variable that is created for further use in the package, Default: 'treated'

Examples

Run this code

pool_data <- data.frame(
  cov1   = rnorm(100, 11, 2),
  cov2   = rnorm(100, 11, 2),
  cov3   = rnorm(100, 11, 2),
  sex    = rbinom(100, 1, 0.5))

tg_data <- data.frame(
  cov2   = rnorm(20, 12, 1),
  cov3   = rnorm(20, 12, 1),
  cov4   = rnorm(20, 12, 1),
  sex    = rbinom(20, 1, 0.5))

 dx <- combine_data(pool_data, tg_data)
 str(dx)

Run the code above in your browser using DataLab