packages

# install if required
if(!require(googlesheets4)){install.packages("googlesheets4")}
if(!require(ggplot2)){install.packages("ggplot2")}
# Load
library(googlesheets4); gs4_deauth()
library(ggplot2)

Data import

Read Cancer data link
_________________________________________________________

Base de datos en Google-Sheet _________________________________________________________

ss= "https://docs.google.com/spreadsheets/d/1LeWK4oWVBMxviv88UcEu2zqqiXmKRMjvpIkK0vvuhW4/edit?usp=sharing"
hoja="cancer"
rango="A2:AA8527"
can <- read_sheet(ss,
                  sheet=hoja,
                  range=rango,
                  col_names = TRUE,
                  col_types = NULL,
                  na= "NA")
#
can <- within(can, 
              {
  Married <- factor(Married, levels = 0:1, labels = c("no", "yes"))
  DID <- factor(DID)
  HID <- factor(HID)
  FamilyHx <- factor(FamilyHx)
  SmokingHx <- factor(SmokingHx)
  Sex <- factor(Sex)
  CancerStage <- factor(CancerStage)
  School <- factor(School)
  }
  )
str(can)
## tibble [8,525 x 27] (S3: tbl_df/tbl/data.frame)
##  $ remission   : num [1:8525] 0 0 0 0 0 0 0 0 0 0 ...
##  $ ntumors     : num [1:8525] 0 0 0 0 0 0 0 0 2 0 ...
##  $ tumorsize   : num [1:8525] 68 64.7 51.6 86.4 53.4 ...
##  $ co2         : num [1:8525] 1.53 1.68 1.53 1.45 1.57 ...
##  $ pain        : num [1:8525] 4 2 6 3 3 4 3 3 4 5 ...
##  $ wound       : num [1:8525] 4 3 3 3 4 5 4 3 4 4 ...
##  $ mobility    : num [1:8525] 2 2 2 2 2 2 2 3 3 3 ...
##  $ nmorphine   : num [1:8525] 0 0 0 0 0 0 0 0 0 0 ...
##  $ lungcapacity: num [1:8525] 0.801 0.326 0.565 0.848 0.886 ...
##  $ Age         : num [1:8525] 65 53.9 53.3 41.4 46.8 ...
##  $ Married     : Factor w/ 2 levels "no","yes": 1 1 2 1 1 2 2 1 2 1 ...
##  $ FamilyHx    : Factor w/ 2 levels "no","yes": 1 1 1 1 1 1 1 1 2 1 ...
##  $ SmokingHx   : Factor w/ 3 levels "a.former","current",..: 1 1 3 1 3 3 2 1 1 3 ...
##  $ Sex         : Factor w/ 2 levels "female","male": 2 1 1 2 2 2 1 2 2 2 ...
##  $ CancerStage : Factor w/ 4 levels "I","II","III",..: 2 2 2 1 2 1 2 2 2 2 ...
##  $ LengthofStay: num [1:8525] 6 6 5 5 6 5 4 5 6 7 ...
##  $ WBC         : num [1:8525] 6088 6700 6043 7163 6443 ...
##  $ RBC         : num [1:8525] 4.87 4.68 5.01 5.27 4.98 ...
##  $ BMI         : num [1:8525] 24.1 29.4 29.5 21.6 29.8 ...
##  $ IL6         : num [1:8525] 3.7 2.63 13.9 3.01 3.89 ...
##  $ CRP         : num [1:8525] 8.086 0.803 4.034 2.126 1.349 ...
##  $ DID         : Factor w/ 407 levels "1","2","3","4",..: 1 1 1 1 1 1 1 1 1 1 ...
##  $ Experience  : num [1:8525] 25 25 25 25 25 25 25 25 25 25 ...
##  $ School      : Factor w/ 2 levels "average","top": 1 1 1 1 1 1 1 1 1 1 ...
##  $ Lawsuits    : num [1:8525] 3 3 3 3 3 3 3 3 3 3 ...
##  $ HID         : Factor w/ 35 levels "1","2","3","4",..: 1 1 1 1 1 1 1 1 1 1 ...
##  $ Medicaid    : num [1:8525] 0.606 0.606 0.606 0.606 0.606 ...