Skip to content

Commit 6bb9fec

Browse files
Merge pull request #85 from rsquaredacademy/develop
fix shiny app bug
2 parents dad3d62 + 7085457 commit 6bb9fec

File tree

95 files changed

+4355
-130
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

95 files changed

+4355
-130
lines changed

DESCRIPTION

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Package: blorr
22
Type: Package
33
Title: Tools for Developing Binary Logistic Regression Models
4-
Version: 0.2.0.9000
4+
Version: 0.2.1
55
Authors@R: person("Aravind", "Hebbali", email = "hebbali.aravind@gmail.com", role = c("aut", "cre"),
66
comment = c(ORCID = "0000-0001-9220-9669"))
77
Description: Tools designed to make it easier for beginner and intermediate users to build and validate
@@ -27,16 +27,26 @@ Imports:
2727
Rcpp,
2828
rlang,
2929
scales,
30+
shiny,
3031
stats,
3132
tibble,
32-
utils,
33-
xplorerr
33+
utils
3434
Suggests:
3535
covr,
36+
descriptr,
37+
grid,
3638
ineq,
39+
jsonlite,
40+
lubridate,
3741
knitr,
42+
readr,
43+
readxl,
3844
rmarkdown,
45+
shinyBS,
46+
shinythemes,
47+
stringr,
3948
testthat,
49+
tidyr,
4050
vdiffr
4151
License: MIT + file LICENSE
4252
URL: URL: https://blorr.rsquaredacademy.com/, https://github.com/rsquaredacademy/blorr

NEWS.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# blorr 0.2.1
2+
3+
This is a patch release to fix bugs in the app.
4+
15
# blorr 0.2.0
26

37
This is a minor release to fix bugs and for other enhancements.

R/blr-bivariate-analysis.R

Lines changed: 1 addition & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,6 @@ blr_bivariate_analysis.default <- function(data, response, ...) {
3939
blr_check_data(data)
4040

4141
data_name <- deparse(substitute(data))
42-
k <- check_choice(quo_name(resp), choices = names(data))
43-
44-
if (k != TRUE) {
45-
46-
cat("Uh oh...", crayon::bold$red(quo_name(resp)), "is not a column in", crayon::bold$blue(data_name), ". Please check the column names using: \n\n", crayon::bold$blue("* names()"), "\n", crayon::bold$blue("* colnames()"), "\n\n")
47-
48-
stop("", call. = FALSE)
49-
}
5042

5143
mdata <-
5244
data %>%
@@ -160,30 +152,12 @@ blr_segment <- function(data, response, predictor) UseMethod("blr_segment")
160152
blr_segment.default <- function(data, response, predictor) {
161153

162154
blr_check_data(data)
163-
# blr_check_varnames(data, response)
164155

165156
resp <- enquo(response)
166157
pred <- enquo(predictor)
167158

168159
data_name <- deparse(substitute(data))
169-
k <- check_choice(quo_name(resp), choices = names(data))
170160

171-
if (k != TRUE) {
172-
173-
cat("Uh oh...", crayon::bold$red(quo_name(resp)), "is not a column in", crayon::bold$blue(data_name), ". Please check the column names using: \n\n", crayon::bold$blue("* names()"), "\n", crayon::bold$blue("* colnames()"), "\n\n")
174-
175-
stop("", call. = FALSE)
176-
}
177-
178-
k2 <- check_choice(quo_name(pred), choices = names(data))
179-
180-
if (k2 != TRUE) {
181-
182-
cat("Uh oh...", crayon::bold$red(quo_name(pred)), "is not a column in", crayon::bold$blue(data_name), ". Please check the column names using: \n\n", crayon::bold$blue("* names()"), "\n", crayon::bold$blue("* colnames()"), "\n\n")
183-
184-
stop("", call. = FALSE)
185-
}
186-
187161
segment_data <-
188162
data %>%
189163
select(!! pred, !! resp) %>%
@@ -232,44 +206,13 @@ blr_segment_twoway <- function(data, response, variable_1, variable_2) UseMethod
232206
blr_segment_twoway.default <- function(data, response, variable_1, variable_2) {
233207

234208
blr_check_data(data)
235-
# blr_check_varnames(data, response)
236-
# blr_check_varnames(data, variable_1)
237-
# blr_check_varnames(data, variable_2)
238-
209+
239210
resp <- enquo(response)
240211
var_1 <- enquo(variable_1)
241212
var_2 <- enquo(variable_2)
242213

243214
data_name <- deparse(substitute(data))
244-
k <- check_choice(quo_name(resp), choices = names(data))
245215

246-
if (k != TRUE) {
247-
248-
cat("Uh oh...", crayon::bold$red(quo_name(resp)), "is not a column in", crayon::bold$blue(data_name), ". Please check the column names using: \n\n", crayon::bold$blue("* names()"), "\n", crayon::bold$blue("* colnames()"), "\n\n")
249-
250-
stop("", call. = FALSE)
251-
}
252-
253-
254-
k2 <- check_choice(quo_name(var_1), choices = names(data))
255-
256-
if (k2 != TRUE) {
257-
258-
cat("Uh oh...", crayon::bold$red(quo_name(var_1)), "is not a column in", crayon::bold$blue(data_name), ". Please check the column names using: \n\n", crayon::bold$blue("* names()"), "\n", crayon::bold$blue("* colnames()"), "\n\n")
259-
260-
stop("", call. = FALSE)
261-
}
262-
263-
k3 <- check_choice(quo_name(var_2), choices = names(data))
264-
265-
if (k3 != TRUE) {
266-
267-
cat("Uh oh...", crayon::bold$red(quo_name(var_2)), "is not a column in", crayon::bold$blue(data_name), ". Please check the column names using: \n\n", crayon::bold$blue("* names()"), "\n", crayon::bold$blue("* colnames()"), "\n\n")
268-
269-
stop("", call. = FALSE)
270-
}
271-
272-
273216
n <- nrow(data)
274217

275218
dat <-

R/blr-gains-table.R

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
#' Oxford, Oxford Uni-versity Press.
2626
#'
2727
#' Sobehart J, Keenan S, Stein R (2000): Benchmarking Quantitative Default Risk Models:
28-
#' A Valid-ation Methodology, Moody’s Investors Service.
28+
#' A Validation Methodology, Moody’s Investors Service.
2929
#'
3030
#' @examples
3131
#' model <- glm(honcomp ~ female + read + science, data = hsb2,
@@ -128,11 +128,9 @@ plot.blr_gains_table <- function(x, title = "Lift Chart", xaxis_title = "% Popul
128128
#' @param ks_line_color Color of the line indicating maximum KS statistic.
129129
#'
130130
#' @references
131-
#' Tjur, T. (2009), "Coefficients of Determination in Logistic Regression Models — A New Proposal:
132-
#' The Coefficient of Discrimination," The American Statistician, 63(4), 366-372.
131+
#' \url{https://doi.org/10.1198/tast.2009.08210}
133132
#'
134-
#' Horn, S. D. (1977), Goodness-of-fit tests for discrete data: a review and an application to a
135-
#' health impairment scale, Biometrics, 33, 237–247.
133+
#' \url{https://www.ncbi.nlm.nih.gov/pubmed/843576}
136134
#'
137135
#' @examples
138136
#' model <- glm(honcomp ~ female + read + science, data = hsb2,

R/blr-hosmer-lemeshow-test.R

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ blr_test_hosmer_lemeshow.default <- function(model, data = NULL) {
3232
blr_check_model(model)
3333

3434
if (is.null(data)) {
35+
resp <- model$y
3536
data <- eval(model$call$data)
36-
resp <- model$y
3737
} else {
3838
namu <-
3939
model %>%
@@ -42,10 +42,8 @@ blr_test_hosmer_lemeshow.default <- function(model, data = NULL) {
4242

4343
blr_check_data(data)
4444

45-
resp <-
46-
data %>%
47-
pull(!! namu) %>%
48-
as.numeric()
45+
resp_temp <- pull(data, !! namu)
46+
resp <- as.numeric(levels(resp_temp))[resp_temp]
4947
}
5048

5149
hoslem_data <- hoslem_data_prep(model, data, resp)

R/blr-launch-app.R

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,6 @@
88
#'
99
blr_launch_app <- function() {
1010

11-
rlang::inform("`blr_launch_app()` has been soft-deprecated and will be removed in the next release. In future, to launch the app, run the below code:\n
12-
- install.packages('xplorerr')\n - xplorerr::app_logistic_regression()\n")
13-
1411
check_suggests('descriptr')
1512
check_suggests('jsonlite')
1613
check_suggests('haven')
@@ -23,7 +20,7 @@ blr_launch_app <- function() {
2320
check_suggests('stringr')
2421
check_suggests('tidyr')
2522

26-
xplorerr::app_logistic_regression()
23+
shiny::runApp(appDir = system.file("application", package = "blorr"))
2724

2825
}
2926

R/blr-linktest.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99
#' @references
1010
#' Pregibon, D. 1979. Data analytic methods for generalized linear models. PhD diss., University of Toronto.
1111
#'
12-
#' Pregibon, D. 1980. Goodness of link tests for generalized linear models. Applied Statistics 29: 15–24.
12+
#' Pregibon, D. 1980. Goodness of link tests for generalized linear models.
1313
#'
14-
#' Tukey, J. W. 1949. One degree of freedom for non-additivity. Biometrics 5: 232–242
14+
#' Tukey, J. W. 1949. One degree of freedom for non-additivity.
1515
#'
1616
#' @examples
1717
#'

R/blr-lorenz-curve.R

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@
1616
#' Müller M, Rönz B (2000): Credit Scoring using Semiparametric Methods. In: Franke J, Härdle W, Stahl G (Eds.):
1717
#' Measuring Risk in Complex Stochastic Systems. New York, Springer-Verlag.
1818
#'
19-
#' Kočenda E, Vojtek M (2011): Default Predictors in Retail Credit Scoring: Evidence from Czech
20-
#' Banking Data. Forthcoming in: Emerging Markets Finance and Trade.
19+
#' \url{https://doi.org/10.2753/REE1540-496X470605}
2120
#'
2221
#' @examples
2322
#' model <- glm(honcomp ~ female + read + science, data = hsb2,

R/blr-model-fit-stats.R

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,7 @@ model_bic <- function(model) {
120120
#' @return McFadden's r-squared.
121121
#'
122122
#' @references
123-
#' McFadden, D. (1974) “Conditional logit analysis of qualitative choice behavior.”
124-
#' Pp. 105-142 in P. Zarembka (ed.), Frontiers in Econometrics. Academic Press.
123+
#' \url{https://eml.berkeley.edu/reprints/mcfadden/zarembka.pdf}
125124
#'
126125
#' @examples
127126
#' model <- glm(honcomp ~ female + read + science, data = hsb2,
@@ -152,8 +151,7 @@ blr_rsq_mcfadden <- function(model) {
152151
#' @return McFadden's adjusted r-squared.
153152
#'
154153
#' @references
155-
#' McFadden, D. (1974) “Conditional logit analysis of qualitative choice behavior.”
156-
#' Pp. 105-142 in P. Zarembka (ed.), Frontiers in Econometrics. Academic Press.
154+
#' \url{https://eml.berkeley.edu/reprints/mcfadden/zarembka.pdf}
157155
#'
158156
#' @examples
159157
#' model <- glm(honcomp ~ female + read + science, data = hsb2,
@@ -218,7 +216,7 @@ blr_rsq_cox_snell <- function(model) {
218216
#'
219217
#' Maddala, G. S. (1983). Limited dependent and qualitative variables in economics. New York: Cambridge Press.
220218
#'
221-
#' Nagelkerke, N. (1991). A note on a general definition of the coefficient of determination. Biometrika, 78, 691–692.
219+
#' Nagelkerke, N. (1991). A note on a general definition of the coefficient of determination.
222220
#'
223221
#' @examples
224222
#' model <- glm(honcomp ~ female + read + science, data = hsb2,

R/blr-pairs.R

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,9 @@
77
#' @return A tibble.
88
#'
99
#' @references
10-
#' Nelsen RB (1998): Concordance and Gini’s measure of association. Journal of Nonparametric
11-
#' Statistics, 9(3):227–238.
10+
#' \url{https://doi.org/10.1080/10485259808832744}
1211
#'
13-
#' Newson R (2006): Confidence intervals for rank statistics: Somers' D and extensions.
14-
#' The Stata Journal, 6(3):309–334.
12+
#' \url{https://doi.org/10.1177/1536867X0600600302}
1513
#'
1614
#' @examples
1715
#' model <- glm(honcomp ~ female + read + science, data = hsb2,

0 commit comments

Comments
 (0)