# Create an object summarizing continous variables

### Description

Create an object summarizing continous variables optionally stratifying by one or more startifying variables and performing statistical tests. Usually, `CreateTableOne`

should be used as the universal frontend for both continuous and categorical data.

### Usage

1 2 3 4 5 | ```
CreateContTable(vars, strata, data, funcNames = c("n", "miss", "p.miss",
"mean", "sd", "median", "p25", "p75", "min", "max", "skew", "kurt"),
funcAdditional, test = TRUE, testNormal = oneway.test,
argsNormal = list(var.equal = TRUE), testNonNormal = kruskal.test,
argsNonNormal = list(NULL), smd = TRUE)
``` |

### Arguments

`vars` |
Variable(s) to be summarized given as a character vector. |

`strata` |
Stratifying (grouping) variable name(s) given as a character vector. If omitted, the overall results are returned. |

`data` |
A data frame in which these variables exist. All variables (both vars and strata) must be in this data frame. |

`funcNames` |
The functions to give the group size, number with missing values, proportion with missing values, mean, standard deviations, median, 25th percentile, 75th percentile, minimum, maximum, skewness (same definition as in SAS), kurtosis (same definition as in SAS). All of them can be seen in the summary method output. The print method uses subset of these. You can choose subset of them or reorder them. They are all configure to omit NA values ( |

`funcAdditional` |
Additional functions can be given as a named list. For example, |

`test` |
If TRUE, as in the default and there are more than two groups, groupwise comparisons are performed. Both tests that assume normality and tests that do not are performed. Either one of the result can be obtained from the print method. |

`testNormal` |
A function used to perform the normal assumption based tests. The default is |

`argsNormal` |
A named list of arguments passed to the function specified in |

`testNonNormal` |
A function used to perform the nonparametric tests. The default is |

`argsNonNormal` |
A named list of arguments passed to the function specified in |

`smd` |
If TRUE, as in the default and there are more than two groups, standardized mean differences for all pairwise comparisons are calculated. |

### Value

An object of class `ContTable`

.

### Author(s)

Kazuki Yoshida (based on `Deducer::descriptive.table()`

)

### See Also

`CreateTableOne`

, `print.ContTable`

, `summary.ContTable`

### Examples

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 | ```
## Load
library(tableone)
## Load Mayo Clinic Primary Biliary Cirrhosis Data
library(survival)
data(pbc)
## Check variables
head(pbc)
## Create an overall table for continuous variables
contVars <- c("time","age","bili","chol","albumin","copper",
"alk.phos","ast","trig","platelet","protime")
contTableOverall <- CreateContTable(vars = contVars, data = pbc)
## Simply typing the object name will invoke the print.ContTable method,
## which will show the sample size, means and standard deviations.
contTableOverall
## To further examine the variables, use the summary.ContTable method,
## which will show more details.
summary(contTableOverall)
## c("age","chol","copper","alk.phos","trig","protime") appear highly skewed.
## Specify them in the nonnormal argument, and the display changes to the median,
## and the [25th, 75th] percentile.
nonNormalVars <- c("age","chol","copper","alk.phos","trig","protime")
print(contTableOverall, nonnormal = nonNormalVars)
## To show median [min,max] for nonnormal variables, use minMax = TRUE
print(contTableOverall, nonnormal = nonNormalVars, minMax = TRUE)
## The table can be stratified by one or more variables
contTableBySexTrt <- CreateContTable(vars = contVars,
strata = c("sex","trt"), data = pbc)
## print now includes p-values which are by default calculated by oneway.test (t-test
## equivalent in the two group case). It is formatted at the decimal place specified
## by the pDigits argument (3 by default). It does <0.001 for you.
contTableBySexTrt
## The nonnormal argument toggles the p-values to the nonparametric result from
## kruskal.test (wilcox.test equivalent for the two group case).
print(contTableBySexTrt, nonnormal = nonNormalVars)
## summary now includes both types of p-values
summary(contTableBySexTrt)
## If your work flow includes copying to Excel and Word when writing manuscripts,
## you may benefit from the quote argument. This will quote everything so that
## Excel does not mess up the cells.
print(contTableBySexTrt, nonnormal = nonNormalVars, quote = TRUE)
## If you want to center-align values in Word, use noSpaces option.
print(contTableBySexTrt, nonnormal = nonNormalVars, quote = TRUE, noSpaces = TRUE)
``` |

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker. Vote for new features on Trello.