Preparación base de datos

  1. Codificación variable tratamiento y edad
  2. Codificación variable ocupación
  3. Codificación variable religión
  4. Diagnósticos
  5. Recodificando tipo de MAC no detectable con una sola variable
  6. Rocidificando el tipo de MAC acorde a las nuevas agrupaciones
library(readxl)
GAT <- read_excel("GAT.xlsx")

Primero se verifica que ek conteo de las columnas sea el mismo que el que se tomó en el artículo de resultados global.

# Cargar las librerías necesarias
library(knitr)
library(kableExtra)

# Crear la tabla
kable(
  data.frame(
    Tratamiento = c("Quimioterapia", "Radioterapia", "Cirugía", "Cuidado Paliativo"),
    Frecuencia = c("2875 (89.6%)", "1064 (34.1%)", "1566 (50.2%)", "32 (1.0%)")
  ),
  format = "html",         # Genera la tabla en formato HTML para bordes y estilo
  align = "c",              # Centra el contenido de las columnas
  col.names = c("Tratamiento", "n (%)")  # Asigna nombres de columnas
) %>%
  kable_styling(
    bootstrap_options = c("striped", "hover", "condensed", "responsive"),
    full_width = F,
    font_size = 15,
    position = "center"
  )
Tratamiento n (%)
Quimioterapia 2875 (89.6%)
Radioterapia 1064 (34.1%)
Cirugía 1566 (50.2%)
Cuidado Paliativo 32 (1.0%)

Se procede a verificar esta información

a <- as.data.frame(table(GAT$BQuimioTerSiste))
b <- as.data.frame(table(GAT$ARadio))
c <- as.data.frame(table(GAT$ACirugia))
d <- as.data.frame(table(GAT$APaliativo))

kable(
  data.frame(
    Tratamiento = c("Quimioterapia", "Radioterapia", "Cirugía", "Cuidado Paliativo"),
    Frecuencia = c(a$Freq[1], b$Freq[1], c$Freq[1], d$Freq[1])
  ),
  format = "html",         # Genera la tabla en formato HTML para bordes y estilo
  align = "c",              # Centra el contenido de las columnas
  col.names = c("Tratamiento", "n")  # Asigna nombres de columnas
) %>%
  kable_styling(
    bootstrap_options = c("striped", "hover", "condensed", "responsive"),
    full_width = F,
    font_size = 15,
    position = "center"
  )
Tratamiento n
Quimioterapia 2875
Radioterapia 1064
Cirugía 1566
Cuidado Paliativo 32

SE DEBEN TOMAR LA VARIBLE CON EL ÍNDICE “B” PARA QUIMIOTERAPIA EN EL RESTO DE TRATAMIENTOS DEBE SER EL “A”.

library(dplyr)

GAT <- GAT %>%
  mutate(
    QUIM = ifelse(tolower(trimws(BQuimioTerSiste)) == "checked", 1, 0),
    RAD = ifelse(tolower(trimws(ARadio)) == "checked", 1, 0),
    CIR = ifelse(tolower(trimws(ACirugia)) == "checked", 1, 0),
    PAL = ifelse(tolower(trimws(APaliativo)) == "checked", 1, 0)
  )

  

library(limma)
V <- vennCounts(GAT[,141:144])
V
##    QUIM RAD CIR PAL Counts
## 1     0   0   0   0     14
## 2     0   0   0   1     30
## 3     0   0   1   0    119
## 4     0   0   1   1      0
## 5     0   1   0   0     33
## 6     0   1   0   1      0
## 7     0   1   1   0     46
## 8     0   1   1   1      0
## 9     1   0   0   0   1149
## 10    1   0   0   1      2
## 11    1   0   1   0    739
## 12    1   0   1   1      0
## 13    1   1   0   0    323
## 14    1   1   0   1      0
## 15    1   1   1   0    662
## 16    1   1   1   1      0
## attr(,"class")
## [1] "VennCounts"
vennDiagram(V, cex = 1, circle.col = c("black", "#8B7E66", "grey", "#B4CDCD"),
            counts.col = "black", lwd = 2)

Los 14 datos excluídos del diagrama de Venn corresponde a pacietes que cumplen algunas de las condicones: “No ha recibido quimioterapia”, “En el momento de la encuesta no recibe radioterapia”, “En el momento de la encuesta no tiene programada cirugía” o “En el momento de la encuesta no está bajo cuidado paliativo”.

Se procede a unificar solo los pacientes de radioterapia y cirugía

GAT <- GAT %>%
  mutate(
    QUIM1 = ifelse(QUIM == 1 & RAD == 0 & CIR == 0 & PAL == 0, 1, 0),
    RAD_Cir = ifelse((RAD == 1 & QUIM == 0 & PAL == 0 & CIR == 0) | (CIR == 1 & QUIM == 0 & PAL == 0 & RAD == 0), 1, 0),
    PAL1 = ifelse(QUIM == 0 & RAD == 0 & CIR == 0 & PAL == 1, 1, 0)
  )
V2 <- vennCounts(GAT[,145:147])
V2
##   QUIM1 RAD_Cir PAL1 Counts
## 1     0       0    0   1786
## 2     0       0    1     30
## 3     0       1    0    152
## 4     0       1    1      0
## 5     1       0    0   1149
## 6     1       0    1      0
## 7     1       1    0      0
## 8     1       1    1      0
## attr(,"class")
## [1] "VennCounts"
vennDiagram(V2, cex = 1, circle.col = c("black", "#8B7E66", "grey"),
            counts.col = "black", lwd = 2)

Se aislaron los pacientes que solo recibieron quimioterpia, los pacientes que solo recibieron radioterapia o cirugía y los que solo están bajo cuidado paliativo.

Ahora se recodifica la base de datos acorde a lo ya presentado

  1. Se recodifica la variable de tratamientos “aislados”.
  2. Recodifiacio variable edad
  3. Codificación variable ocupación
  4. Codificación variable religión
  5. Diagnósticos
  6. Recodificando tipo de MAC no detectable con una sola variable
  7. Rocidificando el tipo de MAC acorde a las nuevas agrupaciones
  8. Se excluyen los pacientes que “no saben” el estadio de su enfermedad
#1 Recodifica la variable tratamiento aislados
GAT <- GAT %>%
  mutate(
    QUIM1 = factor(ifelse(QUIM1 == 1, "Si", "No")),
    RAD_Cir = factor(ifelse(RAD_Cir == 1, "Si", "No")),
    PAL1 = factor(ifelse(PAL1 == 1, "Si", "No"))
  )
#2 Recodifica la edad
GAT <- GAT %>% mutate(Edadcat = cut(Edad, breaks = c(-Inf, 49, 64, Inf), right = F, labels = c("< 50 años", "50 - 64 años", ">=65")))


#3 Recodificando la ocupación
GAT$Nocup <- ifelse(GAT$Ocupacion %in% c("Cesante"), "Cesante",
                    ifelse(GAT$Ocupacion %in% c("Estudiante"), "Estudiante", 
                    ifelse(GAT$Ocupacion %in% c("Empleado", "Independiente"), "Empleado/Independiente",
                    ifelse(GAT$Ocupacion %in% c("Hogar", "Pensionado"), "Hogar/Pensionado",GAT$Ocupacion))))


#4 recodificando la religion
GAT$Nrel <- ifelse(GAT$Religion %in% c("Católica"), "Católica",
                    ifelse(GAT$Religion %in% c("Cristiana"), "Cristiana", 
                    ifelse(GAT$Religion %in% c("Judía", "No profesa religión", "Otra"), "Otra", GAT$Religion)))

#5 Recodificando la variable de tipo de cáncer
GAT$CIE <- ifelse(substr(GAT$TipoCancer, 1, 1) == "D", "D", substr(GAT$TipoCancer, 1, 3))
GAT$Tipotumor <- ifelse(GAT$CIE == "D", "hematologico", "tumor solido")


#6

#Unificando el tipo de MAC que no se capta con un única respuesta

#cuerpo
GAT <- GAT %>%
  mutate(cuerpo = ifelse(rowSums(!is.na(select(., Masaje, Reflexología, Quiropraxia))) > 0 & rowSums(select(., Masaje, Reflexología, Quiropraxia) == "Si", na.rm = TRUE) > 0, 
"Si", "No"))

#terapia energetica
GAT <- GAT %>%
  mutate(energetica = ifelse(rowSums(!is.na(select(., Bioenergética, `Terapia electromagnética`, Acupuntura, TerapiaNeural, Aromaterapia))) > 0 & rowSums(select(., Bioenergética, `Terapia electromagnética`, Acupuntura, TerapiaNeural) == "Si", na.rm = TRUE) > 0, 
"Si", "No"))

#terapia mente
GAT <- GAT %>%
  mutate(mente = ifelse(rowSums(!is.na(select(., Meditacion, Yoga, Taichi, Yorae, OtroMente))) > 0 & rowSums(select(., Meditacion, Yoga, Taichi, Yorae, OtroMente) == "Checked", na.rm = TRUE) > 0, "Si", "No"))


#7 Reagrupando los otros tipos de MAC
library(dplyr)

GAT <- GAT %>%
  mutate(
    Base_planta = ifelse(
      tolower(trimws(Planta)) == "si" | tolower(trimws(Hierbas)) == "si", 
      "Si", 
      "No"
    ),
    Base_animal = ifelse(
      tolower(trimws(Animal)) == "si" | tolower(trimws(OrigenAnimal)) == "si", 
      "Si", 
      "No"
    ),
    Nutricionales = ifelse(
      tolower(trimws(Dieta)) == "si" | tolower(trimws(Vitaminas)) == "si", 
      "Si", 
      "No"
    ),
    whole = ifelse(
      tolower(trimws(Homeopatia)) == "si" | tolower(trimws(Tradicionales)) == "si" | 
      tolower(trimws(cuerpo)) == "si" | tolower(trimws(energetica)) == "si" | 
      tolower(trimws(mente)) == "si", 
      "Si", 
      "No"
    )
  )


#8 excluuyendo pacientes que desconocen el estadio de su enfermedad

GAT_TRAT <- GAT %>% filter(EstadoCancer != "No sabe") # se excluyero 287 pacientes
GAT_TRAT <- GAT_TRAT %>%
  mutate(EstadoCancer = case_when(
EstadoCancer == "Con ganglios comprometidos, pero sin metástasis a otros órganos" | EstadoCancer == "Localizado" ~ "Localizado/Con ganglios comprometidos",
EstadoCancer == "Con metástasis a otros órganos" ~ "Metastasis"
  ))

Cruce de variables

Tratamientos

GAT_TRAT$Sexo <- as.factor(GAT_TRAT$Sexo)
GAT_TRAT$Nrel <- as.factor(GAT_TRAT$Nrel)
GAT_TRAT$Nocup <- as.factor(GAT_TRAT$Nocup)
GAT_TRAT$Tipotumor <- as.factor(GAT_TRAT$Tipotumor)
GAT_TRAT$EstadoCancer <- as.factor(GAT_TRAT$EstadoCancer)

table(GAT_TRAT$QUIM1, GAT_TRAT$AlternativaActual)
##     
##       No  Si
##   No 866 930
##   Si 499 535
myVars1 <- c("Sexo", "Nocup", "Nrel", "Edadcat", "Tipotumor","EstadoCancer", "QUIM1","RAD_Cir" , "PAL1")
catVars1 <- c("Sexo", "Nocup", "Nrel", "Edadcat", "Tipotumor","EstadoCancer", "QUIM1","RAD_Cir" , "PAL1")

library(tableone)
table1 <- CreateTableOne(vars = myVars1, data = GAT_TRAT, factorVars = catVars1, includeNA = FALSE, strata = "AlternativaActual")
table1 <- as.data.frame(print(table1, show.all = TRUE, printToggle = FALSE))

kable(table1, format = "html", caption = "Cruce MAC - VRBLS SOC_DEM.") %>%
  kable_styling(bootstrap_options = c("striped", "hover", "condensed"), 
                full_width = F, 
                position = "center") %>%
  column_spec(1, bold = T, color = "white", background = "#D7261E") %>%
  column_spec(2, border_left = T, background = "#F3E6E3")    
Cruce MAC - VRBLS SOC_DEM.
No Si p test
n 1365 1465
Sexo = Masculino (%) 607 (44.5) 437 (29.8) <0.001
Nocup (%) <0.001
Cesante 223 (16.3) 139 ( 9.5)
Empleado/Independiente 379 (27.8) 478 (32.6)
Estudiante 12 ( 0.9) 16 ( 1.1)
Hogar/Pensionado 751 (55.0) 832 (56.8)
Nrel (%) <0.001
Católica 1104 (80.9) 1110 (75.8)
Cristiana 164 (12.0) 253 (17.3)
Otra 97 ( 7.1) 102 ( 7.0)
Edadcat (%) <0.001
< 50 años 277 (20.3) 361 (24.6)
50 - 64 años 450 (33.0) 594 (40.5)
>=65 638 (46.7) 510 (34.8)
Tipotumor = tumor solido (%) 1329 (97.4) 1421 (97.0) 0.636
EstadoCancer = Metastasis (%) 401 (29.4) 425 (29.0) 0.862
QUIM1 = Si (%) 499 (36.6) 535 (36.5) 1.000
RAD_Cir = Si (%) 76 ( 5.6) 51 ( 3.5) 0.010
PAL1 = Si (%) 13 ( 1.0) 7 ( 0.5) 0.200

Se realiza el cruce de variables en relación al tipo de tratamientos solo para los usuarios.

GAT_MAC <- GAT_TRAT %>% filter(AlternativaActual == "Si")
myVars2 <- c("Sexo", "Nocup", "Nrel", "Edadcat", "Tipotumor", "EstadoCancer")
catVars2 <- c("Sexo", "Nocup", "Nrel", "Edadcat", "Tipotumor", "EstadoCancer")

table2 <- CreateTableOne(vars = myVars2, data = GAT_MAC, factorVars = catVars2, includeNA = FALSE, strata = "QUIM1")
table3 <- CreateTableOne(vars = myVars2, data = GAT_MAC, factorVars = catVars2, includeNA = FALSE, strata = "RAD_Cir")
table4 <- CreateTableOne(vars = myVars2, data = GAT_MAC, factorVars = catVars2, includeNA = FALSE, strata = "PAL1")

table2 <- as.data.frame(print(table2, show.all = TRUE, printToggle = FALSE))
table3 <- as.data.frame(print(table3, show.all = TRUE, printToggle = FALSE))
table4 <- as.data.frame(print(table4, show.all = TRUE, printToggle = FALSE))


kable(table2, format = "html", caption = "Cruce SOLO QUIM - VRBLS SOCIO_DEM.") %>%
  kable_styling(bootstrap_options = c("striped", "hover", "condensed"), 
                full_width = F, 
                position = "center") %>%
  column_spec(1, bold = T, color = "white", background = "blue") %>%
  column_spec(2, border_left = T, background = "#ADD8E6")
Cruce SOLO QUIM - VRBLS SOCIO_DEM.
No Si p test
n 930 535
Sexo = Masculino (%) 282 (30.3) 155 (29.0) 0.628
Nocup (%) 0.271
Cesante 95 (10.2) 44 ( 8.2)
Empleado/Independiente 299 (32.2) 179 (33.5)
Estudiante 13 ( 1.4) 3 ( 0.6)
Hogar/Pensionado 523 (56.2) 309 (57.8)
Nrel (%) 0.008
Católica 728 (78.3) 382 (71.4)
Cristiana 148 (15.9) 105 (19.6)
Otra 54 ( 5.8) 48 ( 9.0)
Edadcat (%) 0.010
< 50 años 208 (22.4) 153 (28.6)
50 - 64 años 377 (40.5) 217 (40.6)
>=65 345 (37.1) 165 (30.8)
Tipotumor = tumor solido (%) 900 (96.8) 521 (97.4) 0.618
EstadoCancer = Metastasis (%) 305 (32.8) 120 (22.4) <0.001
kable(table3, format = "html", caption = "Cruce SOLO RAD y CIR - VRBLS SOCIO_DEM.") %>%
  kable_styling(bootstrap_options = c("striped", "hover", "condensed"), 
                full_width = F, 
                position = "center") %>%
  column_spec(1, bold = T, color = "white", background = "#698B22") %>%
  column_spec(2, border_left = T, background = "#98FB98")
Cruce SOLO RAD y CIR - VRBLS SOCIO_DEM.
No Si p test
n 1414 51
Sexo = Masculino (%) 416 (29.4) 21 (41.2) 0.100
Nocup (%) <0.001
Cesante 133 ( 9.4) 6 (11.8)
Empleado/Independiente 462 (32.7) 16 (31.4)
Estudiante 12 ( 0.8) 4 ( 7.8)
Hogar/Pensionado 807 (57.1) 25 (49.0)
Nrel (%) 0.110
Católica 1072 (75.8) 38 (74.5)
Cristiana 247 (17.5) 6 (11.8)
Otra 95 ( 6.7) 7 (13.7)
Edadcat (%) 0.002
< 50 años 350 (24.8) 11 (21.6)
50 - 64 años 583 (41.2) 11 (21.6)
>=65 481 (34.0) 29 (56.9)
Tipotumor = tumor solido (%) 1372 (97.0) 49 (96.1) 1.000
EstadoCancer = Metastasis (%) 414 (29.3) 11 (21.6) 0.301
kable(table4, format = "html", caption = "Cruce SOLO PAL - VRBLS SOCIO_DEM.") %>%
  kable_styling(bootstrap_options = c("striped", "hover", "condensed"), 
                full_width = F, 
                position = "center") %>%
  column_spec(1, bold = T, color = "white", background = "#8B475D") %>%
  column_spec(2, border_left = T, background = "#FFC0CB")
Cruce SOLO PAL - VRBLS SOCIO_DEM.
No Si p test
n 1458 7
Sexo = Masculino (%) 433 (29.7) 4 (57.1) 0.242
Nocup (%) 0.963
Cesante 138 ( 9.5) 1 (14.3)
Empleado/Independiente 476 (32.6) 2 (28.6)
Estudiante 16 ( 1.1) 0 ( 0.0)
Hogar/Pensionado 828 (56.8) 4 (57.1)
Nrel (%) 0.742
Católica 1105 (75.8) 5 (71.4)
Cristiana 252 (17.3) 1 (14.3)
Otra 101 ( 6.9) 1 (14.3)
Edadcat (%) 0.253
< 50 años 361 (24.8) 0 ( 0.0)
50 - 64 años 591 (40.5) 3 (42.9)
>=65 506 (34.7) 4 (57.1)
Tipotumor = tumor solido (%) 1415 (97.1) 6 (85.7) 0.520
EstadoCancer = Metastasis (%) 421 (28.9) 4 (57.1) 0.220

Se procede a revisar el uso de MAC en la base de datos completa

library(dplyr)
GAT <- GAT %>% 
  mutate(MAC_ANI = ifelse(Base_animal == "Si", 1, 0),
         MAC_PLANT = ifelse(Base_planta == "Si", 1, 0),
         MAC_NUT = ifelse(Nutricionales == "Si", 1, 0),
         MAC_WHOLE = ifelse(whole == "Si", 1, 0))
  
V3 <- vennCounts(GAT[,160:163])
V3
##    MAC_ANI MAC_PLANT MAC_NUT MAC_WHOLE Counts
## 1        0         0       0         0      0
## 2        0         0       0         1      1
## 3        0         0       1         0      1
## 4        0         0       1         1      0
## 5        0         1       0         0    149
## 6        0         1       0         1     35
## 7        0         1       1         0    284
## 8        0         1       1         1    128
## 9        1         0       0         0      0
## 10       1         0       0         1      0
## 11       1         0       1         0      4
## 12       1         0       1         1      2
## 13       1         1       0         0     93
## 14       1         1       0         1     24
## 15       1         1       1         0    165
## 16       1         1       1         1     86
## attr(,"class")
## [1] "VennCounts"
vennDiagram(V3, cex = 1, circle.col = c("black", "#8B7E66", "grey", "#B4CDCD"),
            counts.col = "black", lwd = 2)

Se revisa el uso de MAC, eliminado los que “No conocen el esatdio de la enfermedad”

library(dplyr)
GAT_TRAT <- GAT_TRAT %>% 
  mutate(MAC_ANI = ifelse(Base_animal == "Si", 1, 0),
         MAC_PLANT = ifelse(Base_planta == "Si", 1, 0),
         MAC_NUT = ifelse(Nutricionales == "Si", 1, 0),
         MAC_WHOLE = ifelse(whole == "Si", 1, 0))
  
V4 <- vennCounts(GAT_TRAT[,160:163])
V4
##    MAC_ANI MAC_PLANT MAC_NUT MAC_WHOLE Counts
## 1        0         0       0         0      0
## 2        0         0       0         1      1
## 3        0         0       1         0      1
## 4        0         0       1         1      0
## 5        0         1       0         0    132
## 6        0         1       0         1     34
## 7        0         1       1         0    257
## 8        0         1       1         1    116
## 9        1         0       0         0      0
## 10       1         0       0         1      0
## 11       1         0       1         0      4
## 12       1         0       1         1      2
## 13       1         1       0         0     88
## 14       1         1       0         1     24
## 15       1         1       1         0    154
## 16       1         1       1         1     84
## attr(,"class")
## [1] "VennCounts"
vennDiagram(V4, cex = 1, circle.col = c("black", "#8B7E66", "grey", "#B4CDCD"),
            counts.col = "black", lwd = 2)

Se verifica el anterior resultado filtrando por solo usuarios de MAC

GAT_MAC <- GAT_MAC %>% 
  mutate(MAC_ANI = ifelse(Base_animal == "Si", 1, 0),
         MAC_PLANT = ifelse(Base_planta == "Si", 1, 0),
         MAC_NUT = ifelse(Nutricionales == "Si", 1, 0),
         MAC_WHOLE = ifelse(whole == "Si", 1, 0))
  
V5 <- vennCounts(GAT_MAC[,160:163])
V5
##    MAC_ANI MAC_PLANT MAC_NUT MAC_WHOLE Counts
## 1        0         0       0         0      0
## 2        0         0       0         1      1
## 3        0         0       1         0      1
## 4        0         0       1         1      0
## 5        0         1       0         0    132
## 6        0         1       0         1     34
## 7        0         1       1         0    257
## 8        0         1       1         1    116
## 9        1         0       0         0      0
## 10       1         0       0         1      0
## 11       1         0       1         0      4
## 12       1         0       1         1      2
## 13       1         1       0         0     88
## 14       1         1       0         1     24
## 15       1         1       1         0    154
## 16       1         1       1         1     84
## attr(,"class")
## [1] "VennCounts"
vennDiagram(V5, cex = 1, circle.col = c("black", "#8B7E66", "grey", "#B4CDCD"),
            counts.col = "black", lwd = 2)