-
Notifications
You must be signed in to change notification settings - Fork 31
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
Print issue of roc-class object when a formula object is used for creating roc. #101
Comments
Thanks for the report and the reproducible example. Indeed because the formula is passed as a variable name it seems to be breaking the |
I investigated a fix where I would make the But I'm running into trouble with stuff like
where the data is gone from the environment by the time I'm getting all the data for |
Dear Robin
Thank you for looking into this - I have used pROC a lot and also did not
see any slick way of solving it. Your method sounds like a good solution.
Im surprised the issue has not been brought up before, as many must use
roc() programmatically, or maybe that is exactly why - since one mainly
like to print roc objects for initial exploratory analysis.
Thanks you for taking it up, and for a nice package.
br, Niels
Den søn. 2. jan. 2022 kl. 17.21 skrev Xavier Robin ***@***.***
…:
I investigated a fix where I would make the print function better at
getting the data from the global environment.
But I'm running into trouble with stuff like
form <- as.formula("aval ~ y")
with(df, roc(form))
where the data is gone from the environment by the time print is called.
I'm getting all the data for print.dataline when I build the roc object
within the roc function, so the proper fix will be to save it in the
object. It will however require a major version release, as the objects
will be incompatible.
—
Reply to this email directly, view it on GitHub
<#101 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AGHUKJJM463JZV7CPK4DXXTUUB3R5ANCNFSM5K3YA7EQ>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
This should be fixed on master now, and will be included in the next release. |
Describe the bug
If one programmatically creates formulas using stats::formula or as.formula, when using this in roc(formula=) argument, a print is not able of the resulting roc object.
It seems that this has to do with some non standard evaluation of the argument formula. which is triggered in the method print.dataline() see below rep.ex
To Reproduce
set.seed(123)
df <- data.frame(y = rnorm(10), aval = sample(c(TRUE, FALSE), 10, replace = T))
form <- as.formula("aval ~ y")
roc.obj <- pROC::roc(formula = form, data = df)
print(roc.obj)
#where it fails in print.dataline()
x <- roc.obj
predictor.name <- attr(terms(as.formula(x$call$formula),
data = x$data), "term.labels")
The text was updated successfully, but these errors were encountered: