Description
Create Elegant Table 1 in HTML for Bio-Statistics.
Description
Creates the "table one" of bio-medical papers. Fill it with your data and the name of the variable which you'll make the group(s) out of and it will make univariate, bivariate analysis and parse it into HTML. It also allows you to visualize all your data with graphic representation.
README.md
doudpackage
The goal of doudpackage is to Creates the “table one” of biomedical papers. Fill it with your data and the name of the variable which you’ll make the group(s) out of and it will make univariate, bivariate analysis and parse it into HTML.
Installation
You can install the development version of doudpackage from GitHub with:
# install.packages("devtools")
devtools::install_github("tiago972/doudpackage")
Example
library(doudpackage)
## basic example code
data(iris)
library(stringi)
iris$fact_1<-as.factor(as.character(sample(1:5, 150, replace = TRUE)))
n_na<-sample(1:150, 30)
iris[n_na, "fact_1"]<-NA
iris$fact_2<-as.factor(as.character(stri_rand_strings(150, 1, '[A-B]')))
iris$num<-runif(150, min = 0, max = 100)
n_na<-sample(1:150, 5)
iris[n_na, "num"]<-NA
iris_test<-descTab(iris, group = "Species", na.print = TRUE)
testParse<-parseClassFun(iris_test, levels_to_keep = list("fact_2" = "A"),
group_rows_labels = list("Size" = c("Petal.Length", "Petal.Width"),
"My_f" = c("num", "fact_2")))
setosa | versicolor | virginica | Total | ||
---|---|---|---|---|---|
n = 50 (33.3) | n = 50 (33.3) | n = 50 (33.3) | n = 150 | pvalue | |
Size | |||||
Petal.Length | 1.5 (0.2) | 4.3 (0.5) | 5.6 (0.6) | 3.8 (1.8) | \< 0.001 |
Petal.Width | 0.2 (0.1) | 1.3 (0.2) | 2 (0.3) | 1.2 (0.8) | \< 0.001 |
My_f | |||||
fact_2, A | 24 (48) | 34 (68) | 29 (58) | 87 (58) | 0.128 |
num | 51.2 (28.9) | 47.9 (28.5) | 48.4 (31.7) | 49.2 (29.6) | 0.837 |
Missing values | 0 (0) | 4 (8) | 1 (2) | 5 (3) | |
fact_1, 1 | 8 (16) | 5 (10) | 10 (20) | 23 (15.3) | 0.698 |
fact_1, 2 | 8 (16) | 5 (10) | 3 (6) | 16 (10.7) | 0.698 |
fact_1, 3 | 5 (10) | 8 (16) | 10 (20) | 23 (15.3) | 0.698 |
fact_1, 4 | 9 (18) | 10 (20) | 9 (18) | 28 (18.7) | 0.698 |
fact_1, 5 | 9 (18) | 10 (20) | 11 (22) | 30 (20) | 0.698 |
Missing values | 11 (22) | 12 (24) | 7 (14) | 30 (20) | |
Sepal.Length | 5 (0.4) | 5.9 (0.5) | 6.6 (0.6) | 5.8 (0.8) | \< 0.001 |
Sepal.Width | 3.4 (0.4) | 2.8 (0.3) | 3 (0.3) | 3.1 (0.4) | \< 0.001 |