imbi-heidelberg / descrtab2 Goto Github PK
View Code? Open in Web Editor NEWThis package provides functions to create descriptive statistics tables for continuous and categorical variables.
Home Page: https://imbi-heidelberg.github.io/DescrTab2/
This package provides functions to create descriptive statistics tables for continuous and categorical variables.
Home Page: https://imbi-heidelberg.github.io/DescrTab2/
You can use test_options= list(test_override= "") inside var_options for now. Will fix some time in the future.
todo
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.
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.
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.
These situations are most likely associated with some kind of user error.
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:
I marked the erroneous and the missing group size tags.
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.
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?
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.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.