Skip to content

Instantly share code, notes, and snippets.

#include <Rcpp.h>
using namespace Rcpp;
// [[Rcpp::export]]
IntegerVector recode_outcomes(IntegerVector x) {
int n = x.size();
IntegerVector y(n);
for(int i=0; i<n; i++){
# produce balance statistics -------
## version to pass unquoted
balance_stats_var <- function(data_, treatment_, variable_){
treatment_ <- enquo(treatment_)
variable_ <- enquo(variable_)
temp_means <- group_by(data_, !!treatment_) %>% ## make it possible to change the 'treatment' var
Mode <- function(x, tie = c("missing", "error"), ignore_categories = NULL) {
if(!is.null(ignore_categories)){
x <- x[!(x %in% ignore_categories)]
}