Title: | 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. |
Authors: | Edouard Baudouin [aut, cre] |
Maintainer: | Edouard Baudouin <[email protected]> |
License: | GPL (>= 3) |
Version: | 2.1.0 |
Built: | 2024-10-12 07:07:24 UTC |
Source: | CRAN |
Method to access parseClass initialize,parseClass-method()
elements by name
## S4 method for signature 'parseClass' x[i]
## S4 method for signature 'parseClass' x[i]
x |
: Object |
i |
: Element name |
object
Method to access Var elements by name
## S4 method for signature 'Var' x[i]
## S4 method for signature 'Var' x[i]
x |
: object |
i |
: value |
object of Var
Method to access VarGroup initialize,VarGroup-method()
elements by name
## S4 method for signature 'VarGroup' x[i]
## S4 method for signature 'VarGroup' x[i]
x |
: object |
i |
: value |
object element
Method to modify parseClass initialize,parseClass-method()
elements by name
## S4 replacement method for signature 'parseClass' x[i] <- value
## S4 replacement method for signature 'parseClass' x[i] <- value
x |
: Object |
i |
: Element name |
value |
: Value to be added |
parseClass Object
Method to modify Var elements by name
## S4 replacement method for signature 'Var' x[i] <- value
## S4 replacement method for signature 'Var' x[i] <- value
x |
: object |
i |
: Element name |
value |
: Value to be added |
object
Method to modify VarGroup initialize,VarGroup-method()
elements by name
## S4 replacement method for signature 'VarGroup' x[i] <- value
## S4 replacement method for signature 'VarGroup' x[i] <- value
x |
Object |
i |
Element name |
value |
Value to be added |
object
Generic function of anaBiv which gives bivariate analysis according to group
anaBiv(var, group, parallel, ...)
anaBiv(var, group, parallel, ...)
var |
listVar object or data.frame |
group |
Variable to make subgroups with |
parallel |
Logical. Make analysis using parallel from |
... |
digits.p can be specified as descTab |
A list of VarGroup object or data.frame
Generic function of anaBiv which gives bivariate analysis according to group
## S4 method for signature 'data.frame,character' anaBiv(var, group, parallel, ...)
## S4 method for signature 'data.frame,character' anaBiv(var, group, parallel, ...)
var |
listVar object or data.frame |
group |
Variable to make subgroups with |
parallel |
Logical. Make analysis using parallel from |
... |
digits.p can be specified as descTab |
A list of VarGroup object or data.frame
Generic function of anaBiv which gives bivariate analysis according to group
## S4 method for signature 'listVar,character' anaBiv(var, group, parallel, ...)
## S4 method for signature 'listVar,character' anaBiv(var, group, parallel, ...)
var |
listVar object or data.frame |
group |
Variable to make subgroups with |
parallel |
Logical. Make analysis using parallel from |
... |
digits.p can be specified as descTab |
A list of VarGroup object or data.frame
This function allows you to display all together all univariate analysis (median/mean; IQR/SD; proportions) and bivariates analysis (Wilcoxon, ChiĀ² or Fisher). The univariate analysis can be sub-grouped by a variable of interest of n levels. Appropriate statistics test will be applied
descTab( data, group = NULL, quanti = TRUE, quali = TRUE, na.print = FALSE, pvalue = TRUE, digits.p = 3L, digits.qt = 1L, digits.ql = 1L, normality = "normal", parallel = FALSE, mc.cores = 0 )
descTab( data, group = NULL, quanti = TRUE, quali = TRUE, na.print = FALSE, pvalue = TRUE, digits.p = 3L, digits.qt = 1L, digits.ql = 1L, normality = "normal", parallel = FALSE, mc.cores = 0 )
data |
A datasaset. Needs to be a data.frame/tibble object |
group |
Optional. The name of the variable to make sub-groups comparisons. |
quanti , quali , na.print , pvalue
|
Logical. If false, won't display quantitative/qualitative/Missing values/pvalues variable results |
digits.p |
Integer. Significant digits for p value |
digits.qt |
Integer. Significant digits for mean/median, SD/IQR |
digits.ql |
Integer. Significant digits for proportions |
normality |
One of "assess", "normal", "manual", "non normal". See details |
parallel |
Logical. Make analysis using parallel from |
mc.cores |
If parallel is TRUE, how many Cores to used. |
A S4 objects parseClass()
containing the main table accessible by ["table"] subscript.
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(sample(1:2, 150, replace = TRUE))) n_na<-sample(1:150, 10) iris[n_na, "fact_2"]<-NA iris$fact_3<-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)
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(sample(1:2, 150, replace = TRUE))) n_na<-sample(1:150, 10) iris[n_na, "fact_2"]<-NA iris$fact_3<-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)
anaBiv()
This function is depreciated, please use anaBiv(). anaBiv()
ft_ana_biv(...)
ft_ana_biv(...)
... |
None |
No return value, depreciated
descTab()
This function is depreciated, please use anaBiv(). descTab()
ft_desc_tab(...)
ft_desc_tab(...)
... |
None |
No return value, depreciated
parseClassFun()
This function is depreciated, please use parseClassFun()
ft_parse(...)
ft_parse(...)
... |
None |
No return value, depreciated
Initialization function for parseClass object initialize,parseClass-method()
## S4 method for signature 'parseClass' initialize( .Object, table, group, pvalue, na.print, quanti, quali, var_list, data, digits.qt, digits.ql )
## S4 method for signature 'parseClass' initialize( .Object, table, group, pvalue, na.print, quanti, quali, var_list, data, digits.qt, digits.ql )
.Object |
The object to create |
table |
The result of descTab |
group |
The variable from which to make subgroups |
pvalue , na.print , quanti , quali
|
Values from descTab |
var_list |
An object of listVar |
data |
The dataset provided in descTab |
digits.qt , digits.ql
|
As provided in descTab |
parseClass object
Initialization function for Var initialize,Var-method()
## S4 method for signature 'Var' initialize(.Object, name, type, normal)
## S4 method for signature 'Var' initialize(.Object, name, type, normal)
.Object |
Object to be initialized |
name |
A character taking name of the variable |
type |
A character taking name of the variable type |
normal |
Logical, if variable, is numeric; is it normal |
Var Object
Initialization function for VarGroup initialize,VarGroup-method()
## S4 method for signature 'VarGroup' initialize( .Object, x, group_var, pvalue, parsed_name, value, missing.value, missing.value.name )
## S4 method for signature 'VarGroup' initialize( .Object, x, group_var, pvalue, parsed_name, value, missing.value, missing.value.name )
.Object |
Object to be initialized |
x |
A Var object |
group_var |
The subgroup for which proportions, mean/sd were calculated and missing values |
pvalue |
The calculated pvalue |
parsed_name |
The name of the variable parsed with the n (%), mean (SD) |
value |
The values calculated parsed |
missing.value |
Missing values numbers and proportions n (%) |
missing.value.name |
Missing values concatenate with the level of the variable if it factor |
VarGroup object
Initialization function for parseClass object initialize,parseClass-method()
parseClass( table, group, pvalue, na.print, quanti, quali, var_list, data, digits.qt, digits.ql )
parseClass( table, group, pvalue, na.print, quanti, quali, var_list, data, digits.qt, digits.ql )
table |
The result of descTab |
group |
The variable from which to make subgroups |
pvalue , na.print , quanti , quali
|
Values from descTab |
var_list |
An object of listVar |
data |
The dataset provided in descTab |
digits.qt , digits.ql
|
As provided in descTab |
parseClass object
A S4 class containing all the information needed for parsClassFun the missing values and the group for which it was calculated
table
The result of descTab
group
The variable from which to make subgroups
pvalue,na.print,quanti,quali
Values from descTab descTab()
var_list
An object of listVar listVar-class()
data
The dataset provided in descTab
digits.qt,digits.ql
As provided in descTab
Make the LaTeX/HTML table. Generic function
parseClassFun( table, col.order = NULL, levels_to_keep = NULL, group_rows_labels = NULL )
parseClassFun( table, col.order = NULL, levels_to_keep = NULL, group_rows_labels = NULL )
table |
|
col.order |
Optional. A vector containing the column order. If set, must contains at least all levels of group. Three columns created are "var", "Total", and "pvalue" which can be present in the vector |
levels_to_keep |
Optional, named list. If the variable is binary, which level to keep. Default is the last level of levels(variable). Must be as: list("variable name" = "level to keep"). |
group_rows_labels |
Optional, named list. Create row labels in order to regroup them. Must be as list("label" = c("var1", "var2), "label2" = c("var3", "var4")). |
An HTML/LaTex file which can be used directly in Rmarkdown and copy paste
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")))
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")))
This functions takes the S4 output of descTab to create an HTML parsed table
## S4 method for signature 'parseClass' parseClassFun( table, col.order = NULL, levels_to_keep = NULL, group_rows_labels = NULL )
## S4 method for signature 'parseClass' parseClassFun( table, col.order = NULL, levels_to_keep = NULL, group_rows_labels = NULL )
table |
|
col.order |
Optional. A vector containing the column order. If set, must contains at least all levels of group. Three columns created are "var", "Total", and "pvalue" which can be present in the vector |
levels_to_keep |
Optional, named list. If the variable is binary, which level to keep. Default is the last level of levels(variable). Must be as: list("variable name" = "level to keep"). |
group_rows_labels |
Optional, named list. Create row labels in order to regroup them. Must be as list("label" = c("var1", "var2), "label2" = c("var3", "var4")). |
An HTML/LaTex file which can be used directly in Rmarkdown and copy paste
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")))
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")))
Initialization function for Var initialize,Var-method()
Var(name, type = "", normal = TRUE)
Var(name, type = "", normal = TRUE)
name |
A character taking name of the variable |
type |
A character taking name of the variable type |
normal |
Logical, if variable, is numeric; is it normal |
Var Object
A S4 class containing name, type and normality assessment of variable
name
A character taking name of the variable
type
A character taking name of the variable type
normal
Logical, if variable, is numeric; is it normal
A S4 class containing Var initialize,Var-method()
It also contains the pvalue, the parsed value
the missing values and the group for which it was calculated
group_var
The subgroup for which proportions, mean/sd were calculated and missing values
pvalue
The calculated pvalue
parsed_name
The name of the variable parsed with the n (%), mean (SD)
value
The values calculated parsed
missing.value
Missing values numbers and proportions n (%)
missing.value.name
Missing values concatenate with the level of the variable if it factor