library(survival)
library(ggpubr)
## Loading required package: ggplot2
library(survminer)
## 
## Attaching package: 'survminer'
## The following object is masked from 'package:survival':
## 
##     myeloma
library(gtsummary)
library(dplyr)
## 
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
library(broom)
library(crosstable)
## 
## Attaching package: 'crosstable'
## The following object is masked from 'package:gtsummary':
## 
##     as_gt
str(ovarian)
## 'data.frame':    26 obs. of  6 variables:
##  $ futime  : num  59 115 156 421 431 448 464 475 477 563 ...
##  $ fustat  : num  1 1 1 0 1 0 1 1 0 1 ...
##  $ age     : num  72.3 74.5 66.5 53.4 50.3 ...
##  $ resid.ds: num  2 2 2 2 2 1 2 2 2 1 ...
##  $ rx      : num  1 1 1 2 1 1 2 2 1 2 ...
##  $ ecog.ps : num  1 1 2 1 1 2 2 2 1 2 ...

##Variable Types (with interpretation): Total 6 variables here

  1. futime – Survival time (days)

Numeric, Continuous (quantitative)

  1. fustat – Event status (1 = death, 0 = censored)

Currently Numeric, but should be Categorical Binary (factor)

  1. age – Age of patient (years)

Numeric, Continuous (quantitative)

  1. resid.ds – Residual disease (0 = none, 1 = minimal, 2 = large)

Stored as Numeric, but conceptually Categorical Ordinal

  1. rx – Treatment group (1 or 2)

Stored as Numeric, but conceptually Categorical Nominal

  1. ecog.ps – ECOG performance status (0 = good, 1 = moderate, 2 = poor)

Stored as Numeric, but conceptually Categorical Ordinal

head(ovarian)
##   futime fustat     age resid.ds rx ecog.ps
## 1     59      1 72.3315        2  1       1
## 2    115      1 74.4932        2  1       1
## 3    156      1 66.4658        2  1       2
## 4    421      0 53.3644        2  2       1
## 5    431      1 50.3397        2  1       1
## 6    448      0 56.4301        1  1       2

##Variable types: Here is total 6 variables

  1. futime – survival time in days

Quantitative (continuous numeric)

  1. fustat – survival status (1 = death, 0 = censored)

Qualitative (binary categorical)

  1. age – patient’s age in years

Quantitative (continuous numeric)

  1. resid.ds – residual disease (0 = none, 1 = minimal, 2 = large)

Qualitative (ordinal categorical)

  1. rx – treatment group (1 or 2)

Qualitative (nominal categorical)

  1. ecog.ps – ECOG performance status (0 = good, 1 = moderate, 2 = poor)

Qualitative (ordinal categorical)

summary(ovarian)
##      futime           fustat            age           resid.ds    
##  Min.   :  59.0   Min.   :0.0000   Min.   :38.89   Min.   :1.000  
##  1st Qu.: 368.0   1st Qu.:0.0000   1st Qu.:50.17   1st Qu.:1.000  
##  Median : 476.0   Median :0.0000   Median :56.85   Median :2.000  
##  Mean   : 599.5   Mean   :0.4615   Mean   :56.17   Mean   :1.577  
##  3rd Qu.: 794.8   3rd Qu.:1.0000   3rd Qu.:62.38   3rd Qu.:2.000  
##  Max.   :1227.0   Max.   :1.0000   Max.   :74.50   Max.   :2.000  
##        rx         ecog.ps     
##  Min.   :1.0   Min.   :1.000  
##  1st Qu.:1.0   1st Qu.:1.000  
##  Median :1.5   Median :1.000  
##  Mean   :1.5   Mean   :1.462  
##  3rd Qu.:2.0   3rd Qu.:2.000  
##  Max.   :2.0   Max.   :2.000

##Here is also 6 variables So, based on summary(ovarian) output:

Continuous numeric: futime, age

Categorical binary: fustat

Categorical ordinal: resid.ds, ecog.ps

Categorical nominal: rx