scitb1: scitb1

View source: R/scitb1.R

scitb1R Documentation

scitb1

Description

You can use it to draw a baseline table of data.

Usage

scitb1(vars,fvars=NULL,strata,data,dec,num,nonnormal=NULL,type=NULL,
statistic=F,atotest=T,NormalTest=NULL,fisher=FALSE,correct=FALSE,Overall=FALSE,smd=FALSE)

Arguments

vars

The full range of variables you don't want to compare.

fvars

Define the categorical variables in your data.

strata

Enter the variables to be layered. If you fill in consecutive variables, by default they will be split into 3 layers.

data

Enter your data.

dec

The precision of the data, which defaults to 2 decimal places.

num

When continuous variables are layered, use it to control the number of layers, which defaults to 3.

nonnormal

When the data belongs to a non-normal distribution, this parameter is needed to indicate which is variable is non-normally distributed.

type

The type of encoding generally does not require input.Contains three types: "A", "B", and "C".

statistic

Statistical effect values. Usually, it is the default F, and selecting T will return a statistical effect value.

atotest

Check if the data is normally distributed. The default is T.

NormalTest

A method for detecting whether data is normally distributed.The default values are Kolmogorov Smirnov test and Kolmogorov Smirnov test.Other options are: "ad", "cvm", "pearson".

fisher

Fisher's exact test. The default is FALSE.

correct

Chi square test for continuity correction.The default is FALSE.

Overall

Generate summary data.The default is FALSE.

smd

The default is FALSE. If it is true, return the SMD value.

Details

Table 1 represents the relationship between the baseline values of the data. This function can be easily done.Creates 'Table 1', i.e., description of baseline patient characteristics, which is essential in every medical research. Supports both continuous and categorical variables, as well as p-values and standardized mean differences.

Value

A data frame.

Examples

## Import data
bc<-prematurity
## Hierarchical variables converted to factors.
bc$race<-as.factor(bc$race)
###Define all variables, categorical and stratified.
allVars <-c("age", "lwt",  "smoke", "ptl", "ht", "ui", "ftv", "bwt")
fvars<-c("smoke","ht","ui")
strata<-"race"
out<-scitb1(vars=allVars,fvars=fvars,strata=strata,data=bc)
out<-scitb1(vars=allVars,fvars=fvars,strata=strata,data=bc,statistic=TRUE)
out<-scitb1(vars=allVars,fvars=fvars,strata=strata,data=bc,statistic=TRUE,Overall=TRUE)
out<-scitb1(vars=allVars,fvars=fvars,strata=strata,data=bc,statistic=TRUE,Overall=TRUE,smd=TRUE)
print(out)

###Stratified variables are continuous variables.
allVars <-c("race", "lwt",  "smoke", "ptl", "ht", "ui", "ftv", "bwt")
fvars<-c("smoke","ht","ui","race")
strata<-"age"
out<-scitb1(vars=allVars,fvars=fvars,strata=strata,data=bc)
out<-scitb1(vars=allVars,fvars=fvars,strata=strata,data=bc,statistic=TRUE)
out<-scitb1(vars=allVars,fvars=fvars,strata=strata,data=bc,statistic=TRUE,Overall=TRUE,smd=TRUE)
print(out)


scitb documentation built on June 22, 2024, 10:08 a.m.