## tableone package itself
library(tableone)
## PS matching
library(Matching)
## Loading required package: MASS
## ##
## ## Matching (Version 4.9-3, Build Date: 2018-05-03)
## ## See http://sekhon.berkeley.edu/matching for additional documentation.
## ## Please cite software as:
## ## Jasjeet S. Sekhon. 2011. ``Multivariate and Propensity Score Matching
## ## Software with Automated Balance Optimization: The Matching package for R.''
## ## Journal of Statistical Software, 42(7): 1-52.
## ##
## Weighted analysis
library(survey)
## Loading required package: grid
## Loading required package: Matrix
## Loading required package: survival
##
## Attaching package: 'survey'
## The following object is masked from 'package:graphics':
##
## dotchart
## Reorganizing data
library(reshape2)
## plotting
library(ggplot2)
km<- read.csv("cancer all.csv")
vars <- c("age","sex","ht","wt","bmi", "asa", "htn" , "dm", "an_time" , "op_time" , "opioid" , "n2O", "meta" , "tf" ,"hd","Ca")
## Construct a table
tabUnmatched <- CreateTableOne(vars = vars, strata = "ane_type", data = km, test = FALSE)
## Warning in ModuleReturnVarsExist(vars, data): The data frame does not have:
## Ca Dropped
## Show table with SMD
print(tabUnmatched, smd = TRUE)
## Stratified by ane_type
## 0 1 SMD
## n 903 1304
## age (mean (SD)) 57.92 (11.39) 56.79 (11.81) 0.098
## sex = M (%) 499 (55.3) 570 (43.7) 0.233
## ht (mean (SD)) 160.41 (8.28) 159.43 (8.21) 0.118
## wt (mean (SD)) 61.13 (9.93) 61.16 (16.81) 0.002
## bmi (mean (SD)) 23.85 (3.25) 24.17 (6.35) 0.063
## asa (mean (SD)) 1.56 (0.50) 1.51 (0.50) 0.089
## htn = X (%) 670 (74.2) 963 (73.8) 0.008
## dm = X (%) 782 (86.6) 1154 (88.5) 0.057
## an_time (mean (SD)) 241.87 (81.86) 227.62 (89.28) 0.166
## op_time (mean (SD)) 203.52 (77.90) 191.42 (87.07) 0.146
## opioid = X (%) 1 ( 0.1) 603 (46.2) 1.306
## n2O = X (%) 902 (99.9) 754 (57.8) 1.202
## meta = X (%) 835 (92.5) 1208 (92.6) 0.006
## tf = X (%) 884 (97.9) 1265 (97.0) 0.056
## hd (mean (SD)) 15.74 (8.54) 15.61 (9.70) 0.014