Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

makeFrontier() throws uninformative error if dataset is tibble #32

Open
bfifield opened this issue Feb 1, 2019 · 1 comment
Open

makeFrontier() throws uninformative error if dataset is tibble #32

bfifield opened this issue Feb 1, 2019 · 1 comment

Comments

@bfifield
Copy link

bfifield commented Feb 1, 2019

This package and method are great, thanks for implementing it to make it easy to use!

makeFrontier() will throw an error about the treatment not being 0/1 or TRUE/FALSE when dataset is a tibble, even if the treatment is in fact 0/1. If the dataset is converted to data.frame(), the error goes away, but it took a bit of experimenting to figure that out. Either automatic conversion of tbl to data.frame(), or a more informative warning message would be a big help.

library(tidyverse)
library(MatchingFrontier)

## Make data - t is 0/1
df_tst <- tibble(t = rbinom(100, c(0, 1), .5), 
                 X1 = rnorm(100), 
                 X2 = rnorm(100), 
                 y = rnorm(100))

## Should error with: 
## "Error: In makeFrontier(), the treatment must be either 0/1 (integers) or "TRUE"/"FALSE" (logical)."
makeFrontier(dataset = df_tst, treatment = "t", outcome = "y", match.on = c("X1", "X2"))

## Should run after converting to dataframe
makeFrontier(dataset = as.data.frame(df_tst), treatment = "t", outcome = "y", match.on = c("X1", "X2"))

@nielsenrich
Copy link
Collaborator

Thanks. Don't use tibbles much so didn't know this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants