GithubHelp home page GithubHelp logo

imbi-heidelberg / descrtab2 Goto Github PK

View Code? Open in Web Editor NEW
8.0 2.0 7.0 10.14 MB

This package provides functions to create descriptive statistics tables for continuous and categorical variables.

Home Page: https://imbi-heidelberg.github.io/DescrTab2/

R 97.57% CSS 0.01% SAS 2.42%
descriptive-statistics categorical-variables continuous-variable p-values statistics statistical-tests cran r

descrtab2's Issues

Documentation of confidence intervals

In the package website I did not find a description of the computed confidence intervals. If they correspond to the tests, adding them to the test choice tree would probably make sense. I needed it for referencing it in a publication.

Wilcoxon paired two-sample test does not handle improperly matched data correctly

good_idx <- names(table(id)[table(id) == 2])
if (!all(id %in% good_idx)) {
warning("Removed paired observations with missings.")
}
tibl <- tibble(
var = var,
group = group,
id = id
)
tibl %<>% filter(id %in% good_idx)
level1 <- levels(group)[1]
level2 <- levels(group)[2]
x <-
tibl %>%
filter(group == level1) %>%
arrange(id) %>%
pull(var)
y <-
tibl %>%
filter(group == level2) %>%
arrange(id) %>%
pull(var)

Warning message should read "Data improperly matched". Also need to check table(id, group) < 2 I think.

forcats update

When running the standard iris example from here I obtain:

! `fct_explicit_na()` was deprecated in forcats 1.0.0.
Please use `fct_na_value_to_level()` instead.

Group labels not printed correctly in PDF

I am trying to add group labels using the group_labels = list() option. However, the group labels are printed erroneously. The first group gets a tag "(N=)" for specifying the number of group members, but without actually specifying the number of members. The second group does not even print this tag at all. Here is a reproducible example:

---
title: "Reprex"
author: "Author"
date: "10 2 2022"
output: pdf_document
---

```{r setup, include=FALSE}
library(DescrTab2)
library(tidyverse)
knitr::opts_chunk$set(echo = TRUE)
options(print_format="tex")
```
## R Markdown
```{r cars}
data(mtcars)
mtcars %>% select(mpg, am) %>% # mutate(QL = factor(MWS)) %>% 
   descr(., group = "am", group_labels = list("0" = "Automatic trans.", "1" = "Manual trans."),
             format_options = list(print_CI = FALSE, print_Total = FALSE, caption="Fuel efficiency depending on transmission type"))
```

This example produces the following output:
Incorrect table
I marked the erroneous and the missing group size tags.

In some configurations, unicode characters lead to erros

User observed the following error:

<error/rlang_error>
Obsolete data mask.
x Too late to resolve `Alkohol≥5x/Woche` after the end of `dplyr::mutate()`.
i Did you save an object that uses `Alkohol≥5x/Woche` lazily in a column in the `dplyr::mutate()` expression ?

No idea how to reproduce yet, works on my machine.

documentation of test_options[["indices"]]

Within the excellent usage guidance I couldn't find documentation on how to specify the indices argument when using a paired test. Neither in the test choice tree vignette. I figured out that the variable name of the index variable worked in my case.
Maybe you could add something somewhere?

LaTeX error "Misplaced omit"

I tried to create a descriptive table within an imbiReport2::imbi_report_tex Markdown document with the following chunk:


# Create data frame with 20 variables
df <- data.frame(
  "x1" = 1:10
)

for(i in 2:20){
  df[[paste0("x", i)]] <- 1:10
}

# Print desription table
df %>%
  descr()

The dataset has 20 variables. When compiling the TeX document, it gives the following error:

! Misplaced \omit.
\multispan ->\omit
@multispan
l.296 ...erscript{tt1} Students one-sample t-test}
\ \*

It seems to be caused by a double star (look for \\** in the TeX document) in the longtable environment. When deleting the second star manually in the TeX document, it can be compiled.
Interestingly, this error only occurs for a certain amount of variables/size of table. With 19 and 21 variables, everything works fine. The problem occurs again for 40 variables.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.