lunes, 27 de mayo de 2024

Tutorial

R Notebook

Hay diversos paquetes en R para elaborar tablas. En este tutorial uso el paquete flextable

Emplearé las siguiente variables:

  • Empleo y area de empleo
  • Ocupación según sexo. Jefes de familia
  • Ocupación según sexo. Segundo miembro
  • Crosstabulación de ambos tipos de ocupaciones

use_df_printer()
set_flextable_defaults(
  theme_fun = theme_booktabs,
  big.mark = ".", 
  decimal.mark = ",",
  font.color = "#666666",
  border.color = "#666666",
  padding = 3,
  digits = 2
)
# jefe de familia. # trabaja o estudia actualmente
miembros_ocupacion %>% 
  group_by(sexo) %>% 
  count(trabaja_o_estudia_actualmente) %>% 
  na.omit() %>% 
  mutate(proporcion = n/sum(n)*100,
         proporcion = round(proporcion, 2)) %>% 
    select(Sexo = sexo, 
         "Trabaja o estudia actualmente" = trabaja_o_estudia_actualmente,
          n = n, "%" = proporcion ) %>% 
  flextable() |> # transformo en tabla flex
  theme_booktabs(bold_header = TRUE)|> # negritas en el encabezamiento
  autofit() |>
  merge_v(j = 1) |> 
  valign(j = 1, valign = "top")|> 
  align(align = "center", part = "all", j = 2:4) 
Warning: 'big.mark' and 'decimal.mark' are both '.', which could be confusing

Sexo

Trabaja o estudia actualmente

n

%

FEMENINO

NI TRABAJA NI ESTUDIA

1

2,38

TRABAJA

36

85,71

TRABAJA Y ESTUDIA

5

11,90

MASCULINO

NI TRABAJA NI ESTUDIA

1

1,52

TRABAJA

63

95,45

TRABAJA Y ESTUDIA

2

3,03

# analizo el empleo de los segundos miembros
relacion_con_jefes %>% 
  group_by(sexo) %>% 
  count(empleo) %>% 
  na.omit() %>% 
  mutate(proporcion = n/sum(n),
         proporcion = round(proporcion, 2)) %>% 
  ggplot() +  
  geom_col(
    mapping = aes(
      x = proporcion,         # show pre-calculated proportion values
      y = empleo,          # reverse level order so missing/other at bottom
      fill = sexo),                # stacked by outcome
    width = 0.8)+                    # thinner bars (out of 1)
  # inicio con tufte
  theme_tufte() +                  # Minimal theme 
  theme(legend.position = "bottom",
        axis.title = element_text(size = rel(0.8),
                              face = "bold.italic"),
    # textos en los ejes
    axis.text = element_text(
      size = rel(0.8)),
    panel.grid.major.x  = element_line(color = "#eeeeee"),
    # disminuyo el color de los sticks
    axis.ticks = element_line(color = "#eeeeee")) +
  scale_fill_manual( 
    values = c("MASCULINO" = "violetred",
      "FEMENINO" = "aquamarine")) + 
  labs(x = "Proporción", y = "Empleo")

El 100% de los hombres trabaja de forma exclusiva, en tanto que el 50% de las muejres trabaan con exclusividad

# segundo miembro. trabaja o estudia actualmente

relacion_con_jefes %>% 
  group_by(sexo) %>% 
  count(empleo) %>% 
  na.omit() %>% 
  mutate(proporcion = n/sum(n),
         proporcion = round(proporcion, 2))%>% 
    select(Sexo = sexo, 
         "Trabaja o estudia actualmente" = empleo,
          n = n, "%" = proporcion ) %>% 
  flextable() |> # transformo en tabla flex
  theme_booktabs(bold_header = TRUE)|> # negritas en el encabezamiento
  autofit() |>
  merge_v(j = 1) |> 
  valign(j = 1, valign = "top")|> 
  align(align = "center", part = "all", j = 3:4) 
Warning: 'big.mark' and 'decimal.mark' are both '.', which could be confusing

Sexo

Trabaja o estudia actualmente

n

%

FEMENINO

ESTUDIA

6

0,11

NI TRABAJA NI ESTUDIA

2

0,04

TRABAJA

44

0,81

TRABAJA Y ESTUDIA

2

0,04

MASCULINO

TRABAJA

9

1,00

Otras posibilidades de tabla

glimpse(sanJose_sanguineo)
Rows: 91
Columns: 25
$ `#`                                      <dbl> 1, 2, 3, 4, 5, 6,~
$ `Apellido,Nombre`                        <chr> "Perez Marquina, ~
$ Identificación                           <chr> "VEMJUAPERM200603~
$ Sexo                                     <chr> "M", "M", "F", "F~
$ `Fecha de Nacimiento`                    <chr> "09/03/2006", "28~
$ `Edad Medición`                          <dbl> 16.05, 16.06, 23.~
$ `Edad Actual`                            <dbl> 16.06, 16.07, 23.~
$ `Hemoglobina (g/dl)`                     <dbl> 10.5, 10.8, 10.6,~
$ `Glucosa (mg/dl)`                        <dbl> NA, NA, 101, 124,~
$ `Interpretación Hemoglobina`             <chr> "B- Anemia modera~
$ `Hematocrito (%)`                        <dbl> 39, 35, 32, 39, 3~
$ `Glóbulos Blancos`                       <dbl> NA, NA, 8900, 720~
$ Plaquetas                                <dbl> 202000, 131000, 3~
$ `Triglicéridos (mg/dl)`                  <dbl> NA, NA, 148, 173,~
$ `Interpretación Triglicéridos`           <chr> NA, NA, "Normal",~
$ `Colesterol (mg/dl)`                     <dbl> NA, NA, 176, 173,~
$ `Indicador Colesterol`                   <chr> NA, NA, "Normal",~
$ `HDL Colesterol (mg/dl)`                 <dbl> NA, NA, 66, 47, N~
$ `Interpretación HDL Colesterol (mg/dl)`  <chr> NA, NA, "Normal",~
$ `VLDL Colesterol (mg/dl)`                <dbl> NA, NA, 29, 15, N~
$ `Interpretación VLDL Colesterol`         <chr> NA, NA, "Normal",~
$ `LDL Colesterol (mg/dl)`                 <dbl> NA, NA, 81, 111, ~
$ `Interpretación  LDL Colesterol (mg/dl)` <chr> NA, NA, "Normal",~
$ Observacion                              <chr> NA, NA, NA, NA, N~
$ `Fecha pesquisa`                         <chr> "2022/08/11", "20~
flextable(sjSanguineoE)

Grupo de edades

Variable

n

Min.

Q1.

Mediana

Q3.

Max.

5-19

Colesterol (mg/dl)

6

111.00

123.000

132.500

145.750

150.00

5-19

Edad Actual

6

14.05

17.020

17.060

17.798

19.08

5-19

Glóbulos Blancos

6

9,000.00

9,925.000

11,200.000

15,325.000

131,000.00

5-19

Glucosa (mg/dl)

6

90.00

91.750

96.000

104.000

108.00

5-19

HDL Colesterol (mg/dl)

6

47.00

48.000

48.500

50.500

59.00

5-19

Hematocrito (%)

6

39.00

41.250

42.500

46.000

49.00

5-19

Hemoglobina (g/dl)

6

11.20

12.550

13.500

14.075

14.20

5-19

LDL Colesterol (mg/dl)

6

49.00

57.500

62.000

69.500

85.00

5-19

Plaquetas

6

30,100.00

177,500.000

201,500.000

260,750.000

294,000.00

5-19

Triglicéridos (mg/dl)

6

62.00

69.750

79.000

102.500

153.00

5-19

VLDL Colesterol (mg/dl)

6

12.00

13.500

15.500

20.500

30.00

20+

Colesterol (mg/dl)

38

104.00

135.750

160.000

179.750

628.00

20+

Edad Actual

38

20.04

27.093

41.075

57.070

74.08

20+

Glóbulos Blancos

38

5.00

6,825.000

7,500.000

9,125.000

14,600.00

20+

Glucosa (mg/dl)

38

81.00

95.250

101.000

107.500

139.00

20+

HDL Colesterol (mg/dl)

38

38.00

46.000

49.500

54.750

66.00

20+

Hematocrito (%)

38

32.00

42.250

46.000

50.000

56.00

20+

Hemoglobina (g/dl)

38

10.60

12.825

13.550

14.875

16.20

20+

LDL Colesterol (mg/dl)

38

25.00

61.500

80.000

102.500

556.00

20+

Plaquetas

38

190.00

171,250.000

187,500.000

223,750.000

343,000.00

20+

Triglicéridos (mg/dl)

38

57.00

91.750

110.000

148.750

332.00

20+

VLDL Colesterol (mg/dl)

38

11.00

18.250

22.000

29.750

99.00

# demostracion

fun <- function(x) {
  paste0(
    c("min: ", "max: "),
    formatC(range(x))
  )
}

# aplica la funcion fun() a las columnas de el dataset iris
new_row <- list(
  Sepal.Length = fun(iris$Sepal.Length),
  Sepal.Width =  fun(iris$Sepal.Width),
  Petal.Width =  fun(iris$Petal.Width),
  Petal.Length = fun(iris$Petal.Length)
)

ft_1 <- flextable(data = head(iris))
ft_1 <- add_header(ft_1, values = new_row, top = FALSE)
ft_1 <- append_chunks(ft_1, part = "header", i = 2, )
ft_1 <- theme_booktabs(ft_1, bold_header = TRUE)
ft_1 <- align(ft_1, align = "center", part = "all")
ft_1
flextable(sjSanguineoE) -> sjSanguineoE_ft

Añado encabezado

# covierto em flextable

sjSanguineoE_ft <- add_header_row(sjSanguineoE_ft,
  colwidths = c(6, 2),
  values = c("", "Maximo")
) # evaluar porque me pone el primer valor en la posicion 1.
# quiero que me lo ponga en la posicion 4
  

Aplicación de temas

sjSanguineoE_ft %>% 
  theme_vanilla()

Maximo

Grupo de edades

Variable

n

Min.

Q1.

Mediana

Q3.

Max.

5-19

Colesterol (mg/dl)

6

111.00

123.000

132.500

145.750

150.00

5-19

Edad Actual

6

14.05

17.020

17.060

17.798

19.08

5-19

Glóbulos Blancos

6

9,000.00

9,925.000

11,200.000

15,325.000

131,000.00

5-19

Glucosa (mg/dl)

6

90.00

91.750

96.000

104.000

108.00

5-19

HDL Colesterol (mg/dl)

6

47.00

48.000

48.500

50.500

59.00

5-19

Hematocrito (%)

6

39.00

41.250

42.500

46.000

49.00

5-19

Hemoglobina (g/dl)

6

11.20

12.550

13.500

14.075

14.20

5-19

LDL Colesterol (mg/dl)

6

49.00

57.500

62.000

69.500

85.00

5-19

Plaquetas

6

30,100.00

177,500.000

201,500.000

260,750.000

294,000.00

5-19

Triglicéridos (mg/dl)

6

62.00

69.750

79.000

102.500

153.00

5-19

VLDL Colesterol (mg/dl)

6

12.00

13.500

15.500

20.500

30.00

20+

Colesterol (mg/dl)

38

104.00

135.750

160.000

179.750

628.00

20+

Edad Actual

38

20.04

27.093

41.075

57.070

74.08

20+

Glóbulos Blancos

38

5.00

6,825.000

7,500.000

9,125.000

14,600.00

20+

Glucosa (mg/dl)

38

81.00

95.250

101.000

107.500

139.00

20+

HDL Colesterol (mg/dl)

38

38.00

46.000

49.500

54.750

66.00

20+

Hematocrito (%)

38

32.00

42.250

46.000

50.000

56.00

20+

Hemoglobina (g/dl)

38

10.60

12.825

13.550

14.875

16.20

20+

LDL Colesterol (mg/dl)

38

25.00

61.500

80.000

102.500

556.00

20+

Plaquetas

38

190.00

171,250.000

187,500.000

223,750.000

343,000.00

20+

Triglicéridos (mg/dl)

38

57.00

91.750

110.000

148.750

332.00

20+

VLDL Colesterol (mg/dl)

38

11.00

18.250

22.000

29.750

99.00

sjSanguineoE_ft %>% 
    theme_alafoli()

Maximo

Grupo de edades

Variable

n

Min.

Q1.

Mediana

Q3.

Max.

5-19

Colesterol (mg/dl)

6

111.00

123.000

132.500

145.750

150.00

5-19

Edad Actual

6

14.05

17.020

17.060

17.798

19.08

5-19

Glóbulos Blancos

6

9,000.00

9,925.000

11,200.000

15,325.000

131,000.00

5-19

Glucosa (mg/dl)

6

90.00

91.750

96.000

104.000

108.00

5-19

HDL Colesterol (mg/dl)

6

47.00

48.000

48.500

50.500

59.00

5-19

Hematocrito (%)

6

39.00

41.250

42.500

46.000

49.00

5-19

Hemoglobina (g/dl)

6

11.20

12.550

13.500

14.075

14.20

5-19

LDL Colesterol (mg/dl)

6

49.00

57.500

62.000

69.500

85.00

5-19

Plaquetas

6

30,100.00

177,500.000

201,500.000

260,750.000

294,000.00

5-19

Triglicéridos (mg/dl)

6

62.00

69.750

79.000

102.500

153.00

5-19

VLDL Colesterol (mg/dl)

6

12.00

13.500

15.500

20.500

30.00

20+

Colesterol (mg/dl)

38

104.00

135.750

160.000

179.750

628.00

20+

Edad Actual

38

20.04

27.093

41.075

57.070

74.08

20+

Glóbulos Blancos

38

5.00

6,825.000

7,500.000

9,125.000

14,600.00

20+

Glucosa (mg/dl)

38

81.00

95.250

101.000

107.500

139.00

20+

HDL Colesterol (mg/dl)

38

38.00

46.000

49.500

54.750

66.00

20+

Hematocrito (%)

38

32.00

42.250

46.000

50.000

56.00

20+

Hemoglobina (g/dl)

38

10.60

12.825

13.550

14.875

16.20

20+

LDL Colesterol (mg/dl)

38

25.00

61.500

80.000

102.500

556.00

20+

Plaquetas

38

190.00

171,250.000

187,500.000

223,750.000

343,000.00

20+

Triglicéridos (mg/dl)

38

57.00

91.750

110.000

148.750

332.00

20+

VLDL Colesterol (mg/dl)

38

11.00

18.250

22.000

29.750

99.00

sjSanguineoE_ft %>% 
    theme_apa()

Maximo

Grupo de edades

Variable

n

Min.

Q1.

Mediana

Q3.

Max.

5-19

Colesterol (mg/dl)

6.00

111.00

123.00

132.50

145.75

150.00

5-19

Edad Actual

6.00

14.05

17.02

17.06

17.80

19.08

5-19

Glóbulos Blancos

6.00

9,000.00

9,925.00

11,200.00

15,325.00

131,000.00

5-19

Glucosa (mg/dl)

6.00

90.00

91.75

96.00

104.00

108.00

5-19

HDL Colesterol (mg/dl)

6.00

47.00

48.00

48.50

50.50

59.00

5-19

Hematocrito (%)

6.00

39.00

41.25

42.50

46.00

49.00

5-19

Hemoglobina (g/dl)

6.00

11.20

12.55

13.50

14.07

14.20

5-19

LDL Colesterol (mg/dl)

6.00

49.00

57.50

62.00

69.50

85.00

5-19

Plaquetas

6.00

30,100.00

177,500.00

201,500.00

260,750.00

294,000.00

5-19

Triglicéridos (mg/dl)

6.00

62.00

69.75

79.00

102.50

153.00

5-19

VLDL Colesterol (mg/dl)

6.00

12.00

13.50

15.50

20.50

30.00

20+

Colesterol (mg/dl)

38.00

104.00

135.75

160.00

179.75

628.00

20+

Edad Actual

38.00

20.04

27.09

41.08

57.07

74.08

20+

Glóbulos Blancos

38.00

5.00

6,825.00

7,500.00

9,125.00

14,600.00

20+

Glucosa (mg/dl)

38.00

81.00

95.25

101.00

107.50

139.00

20+

HDL Colesterol (mg/dl)

38.00

38.00

46.00

49.50

54.75

66.00

20+

Hematocrito (%)

38.00

32.00

42.25

46.00

50.00

56.00

20+

Hemoglobina (g/dl)

38.00

10.60

12.82

13.55

14.88

16.20

20+

LDL Colesterol (mg/dl)

38.00

25.00

61.50

80.00

102.50

556.00

20+

Plaquetas

38.00

190.00

171,250.00

187,500.00

223,750.00

343,000.00

20+

Triglicéridos (mg/dl)

38.00

57.00

91.75

110.00

148.75

332.00

20+

VLDL Colesterol (mg/dl)

38.00

11.00

18.25

22.00

29.75

99.00

NA
sjSanguineoE_ft %>% 
    theme_booktabs()

Maximo

Grupo de edades

Variable

n

Min.

Q1.

Mediana

Q3.

Max.

5-19

Colesterol (mg/dl)

6

111.00

123.000

132.500

145.750

150.00

5-19

Edad Actual

6

14.05

17.020

17.060

17.798

19.08

5-19

Glóbulos Blancos

6

9,000.00

9,925.000

11,200.000

15,325.000

131,000.00

5-19

Glucosa (mg/dl)

6

90.00

91.750

96.000

104.000

108.00

5-19

HDL Colesterol (mg/dl)

6

47.00

48.000

48.500

50.500

59.00

5-19

Hematocrito (%)

6

39.00

41.250

42.500

46.000

49.00

5-19

Hemoglobina (g/dl)

6

11.20

12.550

13.500

14.075

14.20

5-19

LDL Colesterol (mg/dl)

6

49.00

57.500

62.000

69.500

85.00

5-19

Plaquetas

6

30,100.00

177,500.000

201,500.000

260,750.000

294,000.00

5-19

Triglicéridos (mg/dl)

6

62.00

69.750

79.000

102.500

153.00

5-19

VLDL Colesterol (mg/dl)

6

12.00

13.500

15.500

20.500

30.00

20+

Colesterol (mg/dl)

38

104.00

135.750

160.000

179.750

628.00

20+

Edad Actual

38

20.04

27.093

41.075

57.070

74.08

20+

Glóbulos Blancos

38

5.00

6,825.000

7,500.000

9,125.000

14,600.00

20+

Glucosa (mg/dl)

38

81.00

95.250

101.000

107.500

139.00

20+

HDL Colesterol (mg/dl)

38

38.00

46.000

49.500

54.750

66.00

20+

Hematocrito (%)

38

32.00

42.250

46.000

50.000

56.00

20+

Hemoglobina (g/dl)

38

10.60

12.825

13.550

14.875

16.20

20+

LDL Colesterol (mg/dl)

38

25.00

61.500

80.000

102.500

556.00

20+

Plaquetas

38

190.00

171,250.000

187,500.000

223,750.000

343,000.00

20+

Triglicéridos (mg/dl)

38

57.00

91.750

110.000

148.750

332.00

20+

VLDL Colesterol (mg/dl)

38

11.00

18.250

22.000

29.750

99.00

sjSanguineoE_ft %>% 
    theme_tron()

Maximo

Grupo de edades

Variable

n

Min.

Q1.

Mediana

Q3.

Max.

5-19

Colesterol (mg/dl)

6

111.00

123.000

132.500

145.750

150.00

5-19

Edad Actual

6

14.05

17.020

17.060

17.798

19.08

5-19

Glóbulos Blancos

6

9,000.00

9,925.000

11,200.000

15,325.000

131,000.00

5-19

Glucosa (mg/dl)

6

90.00

91.750

96.000

104.000

108.00

5-19

HDL Colesterol (mg/dl)

6

47.00

48.000

48.500

50.500

59.00

5-19

Hematocrito (%)

6

39.00

41.250

42.500

46.000

49.00

5-19

Hemoglobina (g/dl)

6

11.20

12.550

13.500

14.075

14.20

5-19

LDL Colesterol (mg/dl)

6

49.00

57.500

62.000

69.500

85.00

5-19

Plaquetas

6

30,100.00

177,500.000

201,500.000

260,750.000

294,000.00

5-19

Triglicéridos (mg/dl)

6

62.00

69.750

79.000

102.500

153.00

5-19

VLDL Colesterol (mg/dl)

6

12.00

13.500

15.500

20.500

30.00

20+

Colesterol (mg/dl)

38

104.00

135.750

160.000

179.750

628.00

20+

Edad Actual

38

20.04

27.093

41.075

57.070

74.08

20+

Glóbulos Blancos

38

5.00

6,825.000

7,500.000

9,125.000

14,600.00

20+

Glucosa (mg/dl)

38

81.00

95.250

101.000

107.500

139.00

20+

HDL Colesterol (mg/dl)

38

38.00

46.000

49.500

54.750

66.00

20+

Hematocrito (%)

38

32.00

42.250

46.000

50.000

56.00

20+

Hemoglobina (g/dl)

38

10.60

12.825

13.550

14.875

16.20

20+

LDL Colesterol (mg/dl)

38

25.00

61.500

80.000

102.500

556.00

20+

Plaquetas

38

190.00

171,250.000

187,500.000

223,750.000

343,000.00

20+

Triglicéridos (mg/dl)

38

57.00

91.750

110.000

148.750

332.00

20+

VLDL Colesterol (mg/dl)

38

11.00

18.250

22.000

29.750

99.00

sjSanguineoE_ft %>% 
    theme_tron_legacy()

Maximo

Grupo de edades

Variable

n

Min.

Q1.

Mediana

Q3.

Max.

5-19

Colesterol (mg/dl)

6

111.00

123.000

132.500

145.750

150.00

5-19

Edad Actual

6

14.05

17.020

17.060

17.798

19.08

5-19

Glóbulos Blancos

6

9,000.00

9,925.000

11,200.000

15,325.000

131,000.00

5-19

Glucosa (mg/dl)

6

90.00

91.750

96.000

104.000

108.00

5-19

HDL Colesterol (mg/dl)

6

47.00

48.000

48.500

50.500

59.00

5-19

Hematocrito (%)

6

39.00

41.250

42.500

46.000

49.00

5-19

Hemoglobina (g/dl)

6

11.20

12.550

13.500

14.075

14.20

5-19

LDL Colesterol (mg/dl)

6

49.00

57.500

62.000

69.500

85.00

5-19

Plaquetas

6

30,100.00

177,500.000

201,500.000

260,750.000

294,000.00

5-19

Triglicéridos (mg/dl)

6

62.00

69.750

79.000

102.500

153.00

5-19

VLDL Colesterol (mg/dl)

6

12.00

13.500

15.500

20.500

30.00

20+

Colesterol (mg/dl)

38

104.00

135.750

160.000

179.750

628.00

20+

Edad Actual

38

20.04

27.093

41.075

57.070

74.08

20+

Glóbulos Blancos

38

5.00

6,825.000

7,500.000

9,125.000

14,600.00

20+

Glucosa (mg/dl)

38

81.00

95.250

101.000

107.500

139.00

20+

HDL Colesterol (mg/dl)

38

38.00

46.000

49.500

54.750

66.00

20+

Hematocrito (%)

38

32.00

42.250

46.000

50.000

56.00

20+

Hemoglobina (g/dl)

38

10.60

12.825

13.550

14.875

16.20

20+

LDL Colesterol (mg/dl)

38

25.00

61.500

80.000

102.500

556.00

20+

Plaquetas

38

190.00

171,250.000

187,500.000

223,750.000

343,000.00

20+

Triglicéridos (mg/dl)

38

57.00

91.750

110.000

148.750

332.00

20+

VLDL Colesterol (mg/dl)

38

11.00

18.250

22.000

29.750

99.00

sjSanguineoE_ft %>% 
    theme_vader()

Maximo

Grupo de edades

Variable

n

Min.

Q1.

Mediana

Q3.

Max.

5-19

Colesterol (mg/dl)

6

111.00

123.000

132.500

145.750

150.00

5-19

Edad Actual

6

14.05

17.020

17.060

17.798

19.08

5-19

Glóbulos Blancos

6

9,000.00

9,925.000

11,200.000

15,325.000

131,000.00

5-19

Glucosa (mg/dl)

6

90.00

91.750

96.000

104.000

108.00

5-19

HDL Colesterol (mg/dl)

6

47.00

48.000

48.500

50.500

59.00

5-19

Hematocrito (%)

6

39.00

41.250

42.500

46.000

49.00

5-19

Hemoglobina (g/dl)

6

11.20

12.550

13.500

14.075

14.20

5-19

LDL Colesterol (mg/dl)

6

49.00

57.500

62.000

69.500

85.00

5-19

Plaquetas

6

30,100.00

177,500.000

201,500.000

260,750.000

294,000.00

5-19

Triglicéridos (mg/dl)

6

62.00

69.750

79.000

102.500

153.00

5-19

VLDL Colesterol (mg/dl)

6

12.00

13.500

15.500

20.500

30.00

20+

Colesterol (mg/dl)

38

104.00

135.750

160.000

179.750

628.00

20+

Edad Actual

38

20.04

27.093

41.075

57.070

74.08

20+

Glóbulos Blancos

38

5.00

6,825.000

7,500.000

9,125.000

14,600.00

20+

Glucosa (mg/dl)

38

81.00

95.250

101.000

107.500

139.00

20+

HDL Colesterol (mg/dl)

38

38.00

46.000

49.500

54.750

66.00

20+

Hematocrito (%)

38

32.00

42.250

46.000

50.000

56.00

20+

Hemoglobina (g/dl)

38

10.60

12.825

13.550

14.875

16.20

20+

LDL Colesterol (mg/dl)

38

25.00

61.500

80.000

102.500

556.00

20+

Plaquetas

38

190.00

171,250.000

187,500.000

223,750.000

343,000.00

20+

Triglicéridos (mg/dl)

38

57.00

91.750

110.000

148.750

332.00

20+

VLDL Colesterol (mg/dl)

38

11.00

18.250

22.000

29.750

99.00

sjSanguineoE_ft %>% 
    theme_zebra()

Maximo

Grupo de edades

Variable

n

Min.

Q1.

Mediana

Q3.

Max.

5-19

Colesterol (mg/dl)

6

111.00

123.000

132.500

145.750

150.00

5-19

Edad Actual

6

14.05

17.020

17.060

17.798

19.08

5-19

Glóbulos Blancos

6

9,000.00

9,925.000

11,200.000

15,325.000

131,000.00

5-19

Glucosa (mg/dl)

6

90.00

91.750

96.000

104.000

108.00

5-19

HDL Colesterol (mg/dl)

6

47.00

48.000

48.500

50.500

59.00

5-19

Hematocrito (%)

6

39.00

41.250

42.500

46.000

49.00

5-19

Hemoglobina (g/dl)

6

11.20

12.550

13.500

14.075

14.20

5-19

LDL Colesterol (mg/dl)

6

49.00

57.500

62.000

69.500

85.00

5-19

Plaquetas

6

30,100.00

177,500.000

201,500.000

260,750.000

294,000.00

5-19

Triglicéridos (mg/dl)

6

62.00

69.750

79.000

102.500

153.00

5-19

VLDL Colesterol (mg/dl)

6

12.00

13.500

15.500

20.500

30.00

20+

Colesterol (mg/dl)

38

104.00

135.750

160.000

179.750

628.00

20+

Edad Actual

38

20.04

27.093

41.075

57.070

74.08

20+

Glóbulos Blancos

38

5.00

6,825.000

7,500.000

9,125.000

14,600.00

20+

Glucosa (mg/dl)

38

81.00

95.250

101.000

107.500

139.00

20+

HDL Colesterol (mg/dl)

38

38.00

46.000

49.500

54.750

66.00

20+

Hematocrito (%)

38

32.00

42.250

46.000

50.000

56.00

20+

Hemoglobina (g/dl)

38

10.60

12.825

13.550

14.875

16.20

20+

LDL Colesterol (mg/dl)

38

25.00

61.500

80.000

102.500

556.00

20+

Plaquetas

38

190.00

171,250.000

187,500.000

223,750.000

343,000.00

20+

Triglicéridos (mg/dl)

38

57.00

91.750

110.000

148.750

332.00

20+

VLDL Colesterol (mg/dl)

38

11.00

18.250

22.000

29.750

99.00

Crear una tabla desde cero


# trabajo com mtcars
head(mtcars)

Ejemplo adicional

head(diamonds)

Toma el precio medio de los diamantes, despliega las categorias de la variable “cut” y muestra la densidad de cada uno de los lados del diamante

# tranformo el dataset diamons en una matriz  de datos
z <- as.data.table(diamonds)

# trabajo con los valores medios de una de las columnas

z <- z[, list(
price = mean(price, na.rm = TRUE),
list_col = list(.SD$x) # extraigo todos los valores de las numericas
), by = "cut"] # agrupo by cut..

ft <- flextable(data = z) %>%
  compose(j = "list_col", 
          value = as_paragraph(
plot_chunk(value = list_col,
           type = "dens", 
           col = "pink", 
           width = 1.5, 
           height = .4, 
           free_scale = TRUE) )) %>%
  colformat_double(big.mark = " ", 
                   suffix = " $") %>% 
  set_header_labels(box = "composite content", 
                    density = "density") %>%
  autofit()

ft

cut

price

list_col

Ideal

3 457.5 $

Premium

4 584.3 $

Good

3 928.9 $

Very Good

3 981.8 $

Fair

4 358.8 $

NA

Bajar el número de decimales y crear un solo grupo por cada tramo de edades

sjSanguineoE_ft <- sjSanguineoE_ft |> # transformo en tabla flex
  theme_booktabs(bold_header = TRUE)|> # negritas en el encabezamiento
  autofit() |>
  merge_v(j = 1) |>
  merge_v(j = 2) |>
  valign(j = 1, valign = "top")|> 
  valign(j = 2, valign = "top")|>
  align(align = "center", part = "all", j = 3:8) 
LS0tDQp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XNfcGFyYWdyYXBoKA0KcGxvdF9jaHVuayh2YWx1ZSA9IGxpc3RfY29sLA0KICAgICAgICAgICB0eXBlID0gImRlbnMiLCANCiAgICAgICAgICAgY29sID0gYygicGluayIsICJibHVlIiksIA0KICAgICAgICAgICB3aWR0aCA9IDEuNSwgDQogICAgICAgICAgIGhlaWdodCA9IC40LCANCiAgICAgICAgICAgZnJlZV9zY2FsZSA9IFRSVUUpICkpICU+JQ0KICBjb2xmb3JtYXRfZG91YmxlKGJpZy5tYXJrID0gIiAiLCANCiAgICAgICAgICAgICAgICAgICBzdWZmaXggPSAiIEHDsW9zIikgJT4lIA0KICBzZXRfaGVhZGVyX2xhYmVscyhib3ggPSAiY29tcG9zaXRlIGNvbnRlbnQiLCANCiAgICAgICAgICAgICAgICAgICAgZGVuc2l0eSA9ICJkZW5zaXR5IikgJT4lDQogIGF1dG9maXQoKQ0KDQpmdA0KI3NhdmVfYXNfZG9jeCgibXkgdGFibGUiID0gbXlfdGFibGUsIHBhdGggPSAiZmlsZS5kb2N4IikNCiMgICAgICAgICAgICAgICAgICAgICMgZW5zdXJlIG9ubHkgb25lIGxpbmUgcGVyIHJvdw0KICMgZmxleHRhYmxlOjpzYXZlX2FzX2RvY3gocGF0aCA9ICJkOi9saW1vbmVzL3RhYmxhc0VJbWFnZW5lcy9tZW5vcmVzRG9zRWRhZEdlbmVyby5kb2N4IikgICAjIHNhdmUgYXMgV29yZCBkb2N1bWVudCB0byBmaWxlcGF0aA0KDQpgYGANCg0KDQpgYGB7cn0NCg0KdXNlX2RmX3ByaW50ZXIoKQ0KIyBzdWJzdW1pciBncnVwbyBkZSBlZGFkDQpzalNhbmd1aW5lb0UgJTw+JSANCiAgbXV0YXRlKFZhcmlhYmxlID0gZmFjdG9yKFZhcmlhYmxlLCANCiAgICAgICAgICAgICAgICAgICAgICAgICAgIGxldmVscyA9IGMoIkVkYWQgQWN0dWFsIiwNCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIkdsw7NidWxvcyBCbGFuY29zIiwNCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIkhlbWF0b2NyaXRvICglKSIsDQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJQbGFxdWV0YXMiLCANCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIkhlbW9nbG9iaW5hIChnL2RsKSIsDQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJHbHVjb3NhIChtZy9kbCkiLA0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiVHJpZ2xpY8Opcmlkb3MgKG1nL2RsKSIsDQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJDb2xlc3Rlcm9sIChtZy9kbCkiLA0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiSERMIENvbGVzdGVyb2wgKG1nL2RsKSIsDQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJMREwgQ29sZXN0ZXJvbCAobWcvZGwpIiwNCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIlZMREwgQ29sZXN0ZXJvbCAobWcvZGwpIikpKSANCiAgDQoNCg0KZmxleHRhYmxlKHNqU2FuZ3VpbmVvRSkgLT4gc2pTYW5ndWluZW9FX2Z0DQpzalNhbmd1aW5lb0VfZnQgDQoNCmBgYA0KDQoNCmBgYHtyIGV2YWw9RkFMU0V9DQpmdCAlPiUNCiAgYWRkX2hlYWRlcl9saW5lcygiUGFnZSAiKSAlPiUNCiAgYXBwZW5kX2NodW5rcyhpID0gMSwgcGFydCA9ICJoZWFkZXIiLCBqID0gMSwgYXNfd29yZF9maWVsZCh4ID0gIlBhZ2UiKSkgJT4lIA0KICBzZXRfY2FwdGlvbigNCiAgICBhdXRvbnVtID0gb2ZmaWNlcjo6cnVuX2F1dG9udW0oc2VxX2lkID0gInRhYiIsIGJrbSA9ICJkZW1vX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