Skip to content

Commit

Permalink
pairwise chi-square formulas must be controlled
Browse files Browse the repository at this point in the history
  • Loading branch information
sbalci committed May 10, 2020
1 parent 92a04bf commit 5f18d9f
Show file tree
Hide file tree
Showing 21 changed files with 1,382 additions and 388 deletions.
366 changes: 183 additions & 183 deletions .github/workflows/main.yml

Large diffs are not rendered by default.

28 changes: 14 additions & 14 deletions .github/workflows/r-lib-actions-R-CMD-check.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
on: [push, pull_request]

name: R-CMD-check

jobs:
R-CMD-check:
runs-on: macOS-latest
steps:
- uses: actions/checkout@v1
- uses: r-lib/actions/setup-r@master
- name: Install dependencies
run: Rscript -e "install.packages(c('remotes', 'rcmdcheck'))" -e "remotes::install_deps(dependencies = TRUE)"
- name: Check
run: Rscript -e "rcmdcheck::rcmdcheck(args = '--no-manual', error_on = 'error')"
# on: [push, pull_request]
#
# name: R-CMD-check
#
# jobs:
# R-CMD-check:
# runs-on: macOS-latest
# steps:
# - uses: actions/checkout@v1
# - uses: r-lib/actions/setup-r@master
# - name: Install dependencies
# run: Rscript -e "install.packages(c('remotes', 'rcmdcheck'))" -e "remotes::install_deps(dependencies = TRUE)"
# - name: Check
# run: Rscript -e "rcmdcheck::rcmdcheck(args = '--no-manual', error_on = 'error')"
46 changes: 23 additions & 23 deletions .github/workflows/r-lib-actions-readme.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
on:
push:
paths:
- README.Rmd

name: Render README

jobs:
render:
name: Render README
runs-on: macos-latest
steps:
- uses: actions/checkout@v1
- uses: r-lib/actions/setup-r@v1
- uses: r-lib/actions/setup-pandoc@v1
- name: Install rmarkdown
run: Rscript -e "install.packages('rmarkdown')"
- name: Render README
run: Rscript -e "rmarkdown::render('README.Rmd')"
- name: Commit results
run: |
git commit examples/README.md -m 'Re-build README.Rmd' || echo "No changes to commit"
git push https://${{github.actor}}:${{secrets.GITHUB_TOKEN}}@github.com/${{github.repository}}.git HEAD:${{ github.ref }} || echo "No changes to commit"
# on:
# push:
# paths:
# - README.Rmd
#
# name: Render README
#
# jobs:
# render:
# name: Render README
# runs-on: macos-latest
# steps:
# - uses: actions/checkout@v1
# - uses: r-lib/actions/setup-r@v1
# - uses: r-lib/actions/setup-pandoc@v1
# - name: Install rmarkdown
# run: Rscript -e "install.packages('rmarkdown')"
# - name: Render README
# run: Rscript -e "rmarkdown::render('README.Rmd')"
# - name: Commit results
# run: |
# git commit examples/README.md -m 'Re-build README.Rmd' || echo "No changes to commit"
# git push https://${{github.actor}}:${{secrets.GITHUB_TOKEN}}@github.com/${{github.repository}}.git HEAD:${{ github.ref }} || echo "No changes to commit"
54 changes: 0 additions & 54 deletions .travis.yml

This file was deleted.

54 changes: 54 additions & 0 deletions AAA.travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# # OS: Linux + macOS ------------------------------------------------------------
# # tic documentation: https://docs.ropensci.org/tic/dev/
#
# matrix:
# include:
# - os: osx
# r: release
# - os: linux
# r: release
# env:
# - BUILD_PKGDOWN=true
#
# # meta -------------------------------------------------------------------------
# language: r
# cache:
# - packages
# - $HOME/.ccache
# - $HOME/Library/Caches/Homebrew
# latex: false
#
# # environment variables --------------------------------------------------------
#
# env:
# global:
# - MAKEFLAGS="-j 2"
#
# # Stages -----------------------------------------------------------------------
#
# before_install:
# - if [ "${TRAVIS_OS_NAME}" == "osx" ]; then brew install ccache; fi
# - if [ "${TRAVIS_OS_NAME}" == "osx" ]; then export PATH="/usr/local/opt/ccache/libexec:$PATH"; fi
# - echo -e "options(Ncpus = 8, repos = structure(c(CRAN = 'https://cloud.r-project.org/')))" > $HOME/.Rprofile
# - mkdir -p $HOME/.R && echo -e 'CXX_STD = CXX14\n\nCC=ccache gcc -std=gnu99\nCXX=ccache g++\nCXX11=ccache g++ -std=gnu99\nCXX14=ccache g++ -std=gnu99\nC11=ccache g++\nC14=ccache g++\nFC=ccache gfortran\nF77=ccache gfortran' > $HOME/.R/Makevars
# - mkdir -p $HOME/.ccache && echo -e 'max_size = 5.0G\nsloppiness = include_file_ctime\nhash_dir=false' > $HOME/.ccache/ccache.conf
# - R -q -e 'if (!requireNamespace("remotes")) install.packages("remotes")'
# - R -q -e 'if (getRversion() < "3.2" && !requireNamespace("curl")) install.packages("curl")'
# - R -q -e 'remotes::install_github("ropensci/tic", upgrade = "always"); print(tic::dsl_load()); tic::prepare_all_stages()'
# - R -q -e 'tic::before_install()'
# install:
# - R -q -e 'tic::install()'
# before_script: R -q -e 'tic::before_script()'
# script: R -q -e 'tic::script()'
# after_success: R -q -e 'tic::after_success()'
# after_failure: R -q -e 'tic::after_failure()'
# before_deploy: R -q -e 'tic::before_deploy()'
# deploy:
# provider: script
# script: R -q -e 'tic::deploy()'
# on:
# all_branches: true
# after_deploy: R -q -e 'tic::after_deploy()'
# after_script: R -q -e 'tic::after_script()'
#
# # Custom user code -------------------------------------------------------------
29 changes: 29 additions & 0 deletions AAAappveyor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# # tic documentation: https://docs.ropensci.org/tic/dev/
#
# # Download script file from GitHub
# init:
# ps: |
# $ErrorActionPreference = "Stop"
# Invoke-WebRequest http://raw.github.com/krlmlr/r-appveyor/master/scripts/appveyor-tool.ps1 -OutFile "..\appveyor-tool.ps1"
# Import-Module '..\appveyor-tool.ps1'
#
# install:
# - ps: Bootstrap
# - cmd: Rscript -e "writeLines('options(repos = \'https://cloud.r-project.org\')', '~/.Rprofile')"
# - cmd: Rscript -e "getOption('repos')"
# - cmd: Rscript -e "if (!requireNamespace('remotes')) install.packages('remotes', type = 'binary')"
# - cmd: Rscript -e "if (getRversion() < '3.2' && !requireNamespace('curl')) install.packages('curl', type = 'binary')"
# - cmd: Rscript -e "options(pkgType = 'binary'); remotes::install_github('ropensci/tic', upgrade = 'always'); print(tic::dsl_load()); tic::prepare_all_stages()"
#
# before_build: Rscript -e "tic::before_install()"
# build_script: Rscript -e "tic::install()"
# after_build: Rscript -e "tic::after_install()"
# before_test: Rscript -e "tic::before_script()"
# test_script: Rscript -e "tic::script()"
# on_success: Rscript -e "try(tic::after_success(), silent = TRUE)"
# on_failure: Rscript -e "tic::after_failure()"
# before_deploy: Rscript -e "tic::before_deploy()"
# deploy_script: Rscript -e "tic::deploy()"
# after_deploy: Rscript -e "tic::after_deploy()"
# on_finish: Rscript -e "tic::after_script()"
# # Custom user code -------------------------------------------------------------
12 changes: 12 additions & 0 deletions AAAcodecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# comment: false
#
# coverage:
# status:
# project:
# default:
# target: auto
# threshold: 1%
# patch:
# default:
# target: auto
# threshold: 1%
2 changes: 1 addition & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export(gtsummaryClass)
export(icccoeff)
export(multisurvival)
export(oddsratio)
export(pairchi)
export(pairchi2)
export(reportcat)
export(roc)
export(statsplot2)
Expand Down
60 changes: 46 additions & 14 deletions R/pairchi.h.R
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@

# This file is automatically generated, you probably don't want to edit this

pairchiOptions <- if (requireNamespace('jmvcore')) R6::R6Class(
"pairchiOptions",
pairchi2Options <- if (requireNamespace('jmvcore')) R6::R6Class(
"pairchi2Options",
inherit = jmvcore::Options,
public = list(
initialize = function(
Expand Down Expand Up @@ -32,7 +32,7 @@ pairchiOptions <- if (requireNamespace('jmvcore')) R6::R6Class(

super$initialize(
package='ClinicoPath',
name='pairchi',
name='pairchi2',
requiresData=TRUE,
...)

Expand Down Expand Up @@ -219,7 +219,7 @@ pairchiOptions <- if (requireNamespace('jmvcore')) R6::R6Class(
..pairw = NA)
)

pairchiResults <- if (requireNamespace('jmvcore')) R6::R6Class(
pairchi2Results <- if (requireNamespace('jmvcore')) R6::R6Class(
inherit = jmvcore::Group,
active = list(
freqs = function() private$.items[["freqs"]],
Expand All @@ -228,7 +228,8 @@ pairchiResults <- if (requireNamespace('jmvcore')) R6::R6Class(
nom = function() private$.items[["nom"]],
gamma = function() private$.items[["gamma"]],
taub = function() private$.items[["taub"]],
pw = function() private$.items[["pw"]]),
pw = function() private$.items[["pw"]],
tablepw = function() private$.items[["tablepw"]]),
private = list(),
public=list(
initialize=function(options) {
Expand Down Expand Up @@ -508,19 +509,49 @@ pairchiResults <- if (requireNamespace('jmvcore')) R6::R6Class(
self$add(jmvcore::Preformatted$new(
options=options,
name="pw",
title="Pairwise Chi-Square Comparison"))}))
title="Pairwise Chi-Square Comparison"))
self$add(jmvcore::Table$new(
options=options,
name="tablepw",
title="Pairwise Chi-Square Comparison",
visible="(pairw)",
rows=1,
columns=list(
list(
`name`="method",
`title`="Method",
`type`="text"),
list(
`name`="v1",
`title`="Variable 1",
`type`="text"),
list(
`name`="v2",
`title`="Variable 2",
`type`="text"),
list(
`name`="pv",
`title`="p-value",
`type`="number",
`format`="zto,pvalue")),
clearWith=list(
"rows",
"cols",
"counts",
"layers",
"pairw")))}))

pairchiBase <- if (requireNamespace('jmvcore')) R6::R6Class(
"pairchiBase",
pairchi2Base <- if (requireNamespace('jmvcore')) R6::R6Class(
"pairchi2Base",
inherit = jmvcore::Analysis,
public = list(
initialize = function(options, data=NULL, datasetId="", analysisId="", revision=0) {
super$initialize(
package = 'ClinicoPath',
name = 'pairchi',
name = 'pairchi2',
version = c(1,0,0),
options = options,
results = pairchiResults$new(options=options),
results = pairchi2Results$new(options=options),
data = data,
datasetId = datasetId,
analysisId = analysisId,
Expand Down Expand Up @@ -625,6 +656,7 @@ pairchiBase <- if (requireNamespace('jmvcore')) R6::R6Class(
#' \code{results$gamma} \tab \tab \tab \tab \tab a table of the gamma test results \cr
#' \code{results$taub} \tab \tab \tab \tab \tab a table of the Kendall's tau-b test results \cr
#' \code{results$pw} \tab \tab \tab \tab \tab a preformatted \cr
#' \code{results$tablepw} \tab \tab \tab \tab \tab a table \cr
#' }
#'
#' Tables can be converted to data frames with \code{asDF} or \code{\link{as.data.frame}}. For example:
Expand All @@ -634,7 +666,7 @@ pairchiBase <- if (requireNamespace('jmvcore')) R6::R6Class(
#' \code{as.data.frame(results$freqs)}
#'
#' @export
pairchi <- function(
pairchi2 <- function(
data,
rows,
cols,
Expand Down Expand Up @@ -662,7 +694,7 @@ pairchi <- function(
formula) {

if ( ! requireNamespace('jmvcore'))
stop('pairchi requires jmvcore to be installed (restart may be required)')
stop('pairchi2 requires jmvcore to be installed (restart may be required)')

if ( ! missing(formula)) {
if (missing(counts))
Expand Down Expand Up @@ -711,7 +743,7 @@ pairchi <- function(
for (v in cols) if (v %in% names(data)) data[[v]] <- as.factor(data[[v]])
for (v in layers) if (v %in% names(data)) data[[v]] <- as.factor(data[[v]])

options <- pairchiOptions$new(
options <- pairchi2Options$new(
rows = rows,
cols = cols,
counts = counts,
Expand All @@ -736,7 +768,7 @@ pairchi <- function(
pcTot = pcTot,
pairw = pairw)

analysis <- pairchiClass$new(
analysis <- pairchi2Class$new(
options = options,
data = data)

Expand Down
Loading

0 comments on commit 5f18d9f

Please sign in to comment.