[R] Confusion Table

reichm@@j m@iii@g oii sbcgiob@i@@et reichm@@j m@iii@g oii sbcgiob@i@@et
Thu Jan 17 02:50:11 CET 2019


Ah yes - thank you

-----Original Message-----
From: Jeff Newmiller <jdnewmil using dcn.davis.ca.us> 
Sent: Wednesday, January 16, 2019 6:49 PM
To: r-help using r-project.org; reichmanj using sbcglobal.net
Subject: Re: [R] Confusion Table

If you turn your character variable into a factor and specify the levels argument, you can control the sequence in which any discrete values are presented.

tst_pred <- factor( tst_pred, levels=c("No","Yes") )

On January 16, 2019 4:31:15 PM PST, reichmanj using sbcglobal.net wrote:
>R-Help
>
> 
>
>R-Help community is there an simple straight forward way  of changing 
>my confusion table output to list "Yes" before "No" rather than "No"
>before
>"Yes" - R default.
>
> 
>
># Making predictions on the test set.
>
>tst_pred <- ifelse(predict(model_glm, newdata = default_tst, type =
>"response") > 0.5, "Yes", "No")
>
>tst_tab <- table(predicted = tst_pred, actual = default_tst$default)
>
>tst_tab
>
> 
>
>##                    actual
>
>## predicted   No  Yes
>
>##          No  4817  113
>
>##          Yes      18    52
>
> 
>
>Jeff
>
>
>	[[alternative HTML version deleted]]
>
>______________________________________________
>R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see 
>https://stat.ethz.ch/mailman/listinfo/r-help
>PLEASE do read the posting guide
>http://www.R-project.org/posting-guide.html
>and provide commented, minimal, self-contained, reproducible code.

--
Sent from my phone. Please excuse my brevity.



More information about the R-help mailing list