-
Notifications
You must be signed in to change notification settings - Fork 8
makeFrontier() throws uninformative error if dataset is tibble #32
Copy link
Copy link
Open
Description
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"))
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels