Skip to content

Commit

Permalink
finalfit, survival, survival plot, multivariate survival works
Browse files Browse the repository at this point in the history
  • Loading branch information
sbalci committed Jan 31, 2020
1 parent 08473bf commit b50269d
Show file tree
Hide file tree
Showing 40 changed files with 415 additions and 251 deletions.
1 change: 1 addition & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,4 @@ build
^\.github/
^docs$
^pkgdown$
^img$
34 changes: 24 additions & 10 deletions R/00jmv.R
Original file line number Diff line number Diff line change
Expand Up @@ -146,17 +146,17 @@
`doi`="10.5281/zenodo.2074621"),
`report`=list(
`type`="software",
`author`=NULL,
`year`=2018,
`title`="",
`publisher`="",
`url`="https://CRAN.R-project.org/package=report"),
`author`="Makowski, Dominique, L\u00FCdecke, Daniel",
`year`=2019,
`title`="The report package for R: Ensuring the use of best practices for results reporting",
`publisher`="[R package]. Retrieved from https://github.com/easystats/report",
`url`="https://github.com/easystats/report"),
`arsenal`=list(
`type`="software",
`author`=NULL,
`author`="Heinzen, E Sinnwell, J Atkinson, E Gunderson, T Dougherty, G",
`year`=2018,
`title`="",
`publisher`="",
`title`="arsenal: An Arsenal of 'R' Functions for Large-Scale Statistical Summaries",
`publisher`="[R package]. Retrieved from https://CRAN.R-project.org/package=arsenal",
`url`="https://CRAN.R-project.org/package=arsenal"),
`tangram`=list(
`type`="software",
Expand All @@ -167,7 +167,7 @@
`url`="https://CRAN.R-project.org/package=tangram"),
`irr`=list(
`type`="software",
`author`="Matthias Gamer, Jim Lemon and Ian Fellows Puspendra Singh",
`author`="Matthias Gamer, Jim Lemon, Ian Fellows, Puspendra Singh",
`year`=2019,
`title`="Various Coefficients of Interrater Reliability and Agreement.",
`publisher`="[R package]. Retrieved from https://CRAN.R-project.org/package=irr",
Expand All @@ -185,4 +185,18 @@
`year`=2019,
`title`="janitor: Simple Tools for Examining and Cleaning Dirty Data.",
`publisher`="[R package]. Retrieved from https://CRAN.R-project.org/package=janitor",
`url`="https://CRAN.R-project.org/package=janitor"))
`url`="https://CRAN.R-project.org/package=janitor"),
`finalfit`=list(
`type`="software",
`author`="Ewen Harrison and Tom Drake and Riinu Ots",
`year`=2019,
`title`="finalfit: Quickly Create Elegant Regression Results Tables and Plots when Modelling",
`publisher`="[R package]. Retrieved from https://CRAN.R-project.org/package=finalfit",
`url`="https://CRAN.R-project.org/package=finalfit"),
`caret`=list(
`type`="software",
`author`="Max Kuhn",
`year`=2020,
`title`="caret: Classification and Regression Training",
`publisher`="[R package]. Retrieved from https://CRAN.R-project.org/package=caret",
`url`="https://CRAN.R-project.org/package=caret"))
4 changes: 0 additions & 4 deletions R/agreement.h.R
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,6 @@ agreementBase <- if (requireNamespace('jmvcore')) R6::R6Class(
#' Interrater Intrarater Reliability
#'
#' Function for Interrater Intrarater Reliability.
#'
#' @examples
#' # example will be added
#'
#' @param data .
#' @param vars a string naming the variable from \code{data} that contains the
#' diagnosis given by the observer, variable can be categorical, ordinal or
Expand Down
2 changes: 1 addition & 1 deletion R/correlation.h.R
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ correlationBase <- if (requireNamespace('jmvcore')) R6::R6Class(
completeWhenFilled = FALSE)
}))

#' correlation
#' Correlation
#'
#'
#' @param data .
Expand Down
42 changes: 35 additions & 7 deletions R/crosstable.b.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ crosstableClass <- if (requireNamespace('jmvcore')) R6::R6Class(
.run = function() {


if (length(self$options$vars) == 0)
if (length(self$options$vars) == 0 | length(self$options$group) == 0)
return()

# Arsenal Table
Expand All @@ -20,6 +20,7 @@ crosstableClass <- if (requireNamespace('jmvcore')) R6::R6Class(
formulaL <- jmvcore::constructFormula(terms = self$options$group)

formula <- paste(formulaL, '~', formulaR)

formula <- as.formula(formula)

table1 <- arsenal::tableby(formula, self$data)
Expand All @@ -45,10 +46,10 @@ crosstableClass <- if (requireNamespace('jmvcore')) R6::R6Class(
tangram::html5(
tangram::tangram(
formula, self$data),
fragment=TRUE,
inline="nejm.css",
fragment = TRUE,
inline = "nejm.css",
caption = "Cross Table NEJM Style",
id="tbl3")
id = "tbl3")

results3 <- table3

Expand All @@ -61,17 +62,44 @@ crosstableClass <- if (requireNamespace('jmvcore')) R6::R6Class(
tangram::html5(
tangram::tangram(
formula, self$data),
fragment=TRUE,
inline="lancet.css",
fragment = TRUE,
inline = "lancet.css",
caption = "Cross Table Lancet Style",
id="tbl4")
id = "tbl4")

results4 <- table4

self$results$text4$setContent(results4)



# Table FinalFit

# https://finalfit.org/articles/tables_gallery.html#cross-tables


myvars <- jmvcore::decomposeFormula(formula = formulaR)

myvars <- unlist(myvars)

self$data %>%
summary_factorlist(dependent = self$options$group,
explanatory = myvars,
# column = TRUE,
total_col = TRUE,
p = TRUE,
add_dependent_label = TRUE,
na_include = FALSE
# catTest = catTestfisher
) -> table5

# knitr::kable(table5, row.names = FALSE, align = c('l', 'l', 'r', 'r', 'r'))


results5 <- table5

self$results$text5$setContent(results5)




Expand Down
14 changes: 10 additions & 4 deletions R/crosstable.h.R
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,16 @@ crosstableResults <- if (requireNamespace('jmvcore')) R6::R6Class(
text1 = function() private$.items[["text1"]],
text2 = function() private$.items[["text2"]],
text3 = function() private$.items[["text3"]],
text4 = function() private$.items[["text4"]]),
text4 = function() private$.items[["text4"]],
text5 = function() private$.items[["text5"]]),
private = list(),
public=list(
initialize=function(options) {
super$initialize(
options=options,
name="",
title="CrossTable",
refs="tangram, arsenal")
refs="tangram, arsenal, finalfit")
self$add(jmvcore::Preformatted$new(
options=options,
name="text1",
Expand All @@ -73,7 +74,11 @@ crosstableResults <- if (requireNamespace('jmvcore')) R6::R6Class(
self$add(jmvcore::Html$new(
options=options,
name="text4",
title="CrossTable Tangram Lancet"))}))
title="CrossTable Tangram Lancet"))
self$add(jmvcore::Preformatted$new(
options=options,
name="text5",
title="CrossTable FinalFit"))}))

crosstableBase <- if (requireNamespace('jmvcore')) R6::R6Class(
"crosstableBase",
Expand All @@ -94,7 +99,7 @@ crosstableBase <- if (requireNamespace('jmvcore')) R6::R6Class(
completeWhenFilled = FALSE)
}))

#' CrossTable
#' CrossTables
#'
#' Function for making Cross Tables.
#' @param data .
Expand All @@ -106,6 +111,7 @@ crosstableBase <- if (requireNamespace('jmvcore')) R6::R6Class(
#' \code{results$text2} \tab \tab \tab \tab \tab a preformatted \cr
#' \code{results$text3} \tab \tab \tab \tab \tab a html \cr
#' \code{results$text4} \tab \tab \tab \tab \tab a html \cr
#' \code{results$text5} \tab \tab \tab \tab \tab a preformatted \cr
#' }
#'
#' @export
Expand Down
Loading

0 comments on commit b50269d

Please sign in to comment.