We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
margins() chokes on formulae on variable names with spaces in formulae:
margins()
> mtcars$"No of Cylinders" <- mtcars$cyl > margins(lm(mpg ~ `No of Cylinders`, data = mtcars)) Error in parse(text = x) : <text>:1:4: unexpected symbol 1: No of ^ > traceback() 11: parse(text = x) 10: all.vars(parse(text = x)) 9: FUN(X[[i]], ...) 8: lapply(X = X, FUN = FUN, ...) 7: sapply(names(classes), function(x) all.vars(parse(text = x))) 6: find_terms_in_model(model, variables = variables) 5: marginal_effects.lm(model = model, data = data, variables = variables, type = type, eps = eps, ...) 4: marginal_effects(model = model, data = data, variables = variables, type = type, eps = eps, ...) 3: build_margins(model = model, data = data_list[[i]], variables = variables, type = type, vcov = vcov, vce = vce, iterations = iterations, unit_ses = unit_ses, eps = eps, ...) 2: margins.lm(lm(mpg ~ `No of Cylinders`, data = mtcars)) 1: margins(lm(mpg ~ `No of Cylinders`, data = mtcars))
The text was updated successfully, but these errors were encountered:
9cffafb
Oops, it's back.
> margins::margins(lm(mpg ~ `No of Cylinders`, data = mtcars)) Error in parse(text = x, keep.source = FALSE) : <text>:1:5: unexpected symbol 1: ~No of ^ > traceback() 17: parse(text = x, keep.source = FALSE) 16: eval(parse(text = x, keep.source = FALSE)[[1L]]) 15: formula(eval(parse(text = x, keep.source = FALSE)[[1L]])) 14: formula.character(object, env = baseenv()) 13: formula(object, env = baseenv()) 12: as.formula(new) 11: update.formula(~., paste0("~", x)) 10: update(~., paste0("~", x)) 9: all.vars(update(~., paste0("~", x))) 8: FUN(X[[i]], ...) 7: lapply(terms, function(x) all.vars(update(~., paste0("~", x)))) 6: unlist(lapply(terms, function(x) all.vars(update(~., paste0("~", x))))) 5: unique(unlist(lapply(terms, function(x) all.vars(update(~., paste0("~", x)))))) 4: clean_terms(names(classes)[!classes %in% c("factor", "ordered", "logical")]) 3: find_terms_in_model(model, variables = variables) 2: margins.lm(lm(mpg ~ `No of Cylinders`, data = mtcars)) 1: margins::margins(lm(mpg ~ `No of Cylinders`, data = mtcars))
Sorry, something went wrong.
Fixed (?) again by e140fe9
No branches or pull requests
margins()
chokes on formulae on variable names with spaces in formulae:The text was updated successfully, but these errors were encountered: