Skip to content

Commit

Permalink
# ClinicoPath 0.0.2.0019
Browse files Browse the repository at this point in the history
- rewrote summary of categorical values to decrease dependencies
  • Loading branch information
sbalci committed Jul 3, 2020
1 parent 73c33ed commit b827ce4
Show file tree
Hide file tree
Showing 8 changed files with 179 additions and 30 deletions.
6 changes: 2 additions & 4 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Type: Package
Package: ClinicoPath
Title: Analysis for Clinicopathological Research
Version: 0.0.2.0018
Date: 2020-07-03
Version: 0.0.2.0019
Date: 2020-07-04
Authors@R:
person(given = "Serdar",
family = "Balci",
Expand Down Expand Up @@ -75,10 +75,8 @@ Suggests:
rcrossref
Remotes:
ndphillips/FFTrees,
easystats/report,
spgarbet/tangram,
cran/rmngb,
mixOmicsTeam/mixOmics,
mayoverse/arsenal
VignetteBuilder:
knitr
Expand Down
6 changes: 6 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# ClinicoPath 0.0.2.0019

- rewrote summary of categorical values to decrease dependencies



# ClinicoPath 0.0.2.0018

- added cumulative events and cumulative hazard plots to survival
Expand Down
105 changes: 83 additions & 22 deletions R/reportcat.b.R
Original file line number Diff line number Diff line change
Expand Up @@ -89,28 +89,28 @@ reportcatClass <- if (requireNamespace('jmvcore')) R6::R6Class(
myvars <- unlist(myvars)


myreport <- mydata %>%
select(myvars) %>%
report::report(.,
median = FALSE,
centrality = TRUE,
dispersion = TRUE,
range = TRUE,
distribution = FALSE,
levels_percentage = FALSE,
n_entries = 3,
missing_percentage = FALSE
# median = med,
# centrality = cent,
# dispersion = disp,
# range = ran,
# distribution = distr,
# levels_percentage = lev,
# n_characters = n_ch,
# missing_percentage = mis
)

results1 <- myreport
# myreport <- mydata %>%
# select(myvars) %>%
# report::report(.,
# median = FALSE,
# centrality = TRUE,
# dispersion = TRUE,
# range = TRUE,
# distribution = FALSE,
# levels_percentage = FALSE,
# n_entries = 3,
# missing_percentage = FALSE
# # median = med,
# # centrality = cent,
# # dispersion = disp,
# # range = ran,
# # distribution = distr,
# # levels_percentage = lev,
# # n_characters = n_ch,
# # missing_percentage = mis
# )
#
# results1 <- myreport



Expand All @@ -119,6 +119,67 @@ reportcatClass <- if (requireNamespace('jmvcore')) R6::R6Class(
# dplyr::filter(na > 0)


# for (fac in facs)
# data[[fac]] <- as.factor(data[[fac]])



# catsummary function
catsummary <- function(myvar) {




leng <- length(mydata[[myvar]])

miss <- sum(is.na(mydata[[myvar]]))

valid <- leng - miss

nlev <- nlevels(as.factor(mydata[[myvar]]))

summar <- summary(as.factor(mydata[[myvar]])) %>%
as.table() %>%
tibble::as_tibble(.name_repair = "unique") %>%
dplyr::filter(.[[1]] != "NA's") %>%
dplyr::arrange(dplyr::desc(n))

summar$validtotal <- valid

description <- summar %>%
dplyr::mutate(
percent = n/validtotal
) %>%
dplyr::mutate(
description = glue::glue(
"{...1}: n = {n}, {scales::percent(percent)}. "
)
) %>%
dplyr::select(description) %>%
dplyr::pull(.)


sentence1 <- paste0(
myvar, " has ", leng, " observations and ", nlev, " levels. "
)

sentence3 <- paste0("There are ", miss, " missing values.")

sentence <- c(
sentence1,
unlist(description),
sentence3
)

return(paste0(sentence, collapse = ""))

}



results <- purrr::map(.x = myvars, .f = catsummary)

results1 <- unlist(results)

self$results$text$setContent(results1)

Expand Down
4 changes: 2 additions & 2 deletions codemeta.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
],
"issueTracker": "\n https://github.com/sbalci/ClinicoPathJamoviModule/issues/",
"license": "https://spdx.org/licenses/GPL-3.0",
"version": "0.0.2.17",
"version": "0.0.2.19",
"programmingLanguage": {
"@type": "ComputerLanguage",
"name": "R",
Expand Down Expand Up @@ -657,6 +657,6 @@
"survival-analysis",
"natural-language-summaries"
],
"fileSize": "302.535KB",
"fileSize": "304.534KB",
"readme": "https://github.com/sbalci/ClinicoPathJamoviModule/blob/master/README.md"
}
Binary file modified data/histopathology.omv
Binary file not shown.
Binary file modified inst/extdata/histopathology.omv
Binary file not shown.
4 changes: 2 additions & 2 deletions jamovi/0000.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
---
title: Common Analysis for Clinicopathological Research
name: ClinicoPath
version: 0.0.2.0018
version: 0.0.2.0019
jms: '1.0'
authors:
- Serdar Balci
maintainer: Serdar Balci <drserdarbalci@gmail.com>
date: '2020-07-03'
date: '2020-07-04'
type: R
description: >-
ClinicoPath help researchers to generate natural language summaries of their
Expand Down
84 changes: 84 additions & 0 deletions tododata/todo.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -1196,6 +1196,82 @@ deneme <- readxl::read_xlsx(path = here::here("tododata", "histopathology-templa
```


```{r}
library(magrittr)
myvar <- deneme$LVI
# The data contains 250 observations of the following variables:
# - Group: 2 levels: Control (n = 120, 48.00%); Treatment (n = 129, 51.60%) and missing (n = 1, 0.40%)
# - Sex: 2 levels: Male (n = 128, 51.20%); Female (n = 121, 48.40%) and missing (n = 1, 0.40%)
unique(deneme$LVI)
leng <- length(deneme$LVI)
for (fac in facs)
data[[fac]] <- as.factor(data[[fac]])
miss <- sum(is.na(deneme$LVI))
valid <- leng - miss
nlev <- nlevels(as.factor(deneme$LVI))
unique(as.factor(deneme$LVI))
summar <- summary(as.factor(deneme$LVI)) %>%
as.table() %>%
tibble::as_tibble(.name_repair = "unique") %>%
dplyr::filter(.[[1]] != "NA's")
summar$validtotal <- valid
description <- summar %>%
dplyr::mutate(
percent = n/validtotal
) %>%
dplyr::mutate(
description = glue::glue(
"{...1}: n = {n}, {scales::percent(percent)}"
)
) %>%
dplyr::select(description) %>%
dplyr::pull()
paste0(
myvar, " has ", leng, " observations and ", nlev, " levels.",
unlist(description),
"There are ", miss, "missing values."
)
# catsummary function
catsummary <- function(myvar) {
}
```






```{r report}
deneme <- readxl::read_xlsx(path = here::here("tododata", "histopathology-template2019-11-25.xlsx"))
Expand Down Expand Up @@ -3487,3 +3563,11 @@ ids[["records"]]
```










0 comments on commit b827ce4

Please sign in to comment.