Código
library(tiobeindexr)
library(tidyverse)
library(gt)
library(RColorBrewer)
library(ggthemes)
library(highcharter)
library(gtExtras)
df <- top_20()
df <- df %>% select(1,4,5)
df <- df %>%
mutate(porcentaje_numeric = ifelse(str_detect(Ratings, "%"),
as.numeric(str_remove(Ratings, "%")),
as.numeric(Ratings))) %>%
rename(cuota = porcentaje_numeric) %>%
select(1,2,4)
colores <- c("#3498db", "#2ecc71", "#e74c3c", "#f39c12", "#9b59b6", "#e67e22", "#1abc9c", "#95a5a6")
df_logos <- data.frame(lenguaje = c("Python", "C", "C++", "Java", "C#", "JavaScript", "PHP", "Visual Basic", "SQL", "Assembly language", "Scratch", "Fortran", "Go", "MATLAB", "Kotlin", "Delphi/Object Pascal", "Swift","Ruby","R","Rust"),
logo = c("https://tse4.mm.bing.net/th?id=OIP.EDJ9xoErBbZqK2tExVoJfAAAAA&pid=Api&P=0&h=180","https://tse1.mm.bing.net/th?id=OIP.bkbn2-K7c9rMBV5dvYXDrQHaIh&pid=Api&rs=1&c=1&qlt=95&w=103&h=118","https://tse1.mm.bing.net/th?id=OIP.ggb-3B-8LRfbgS0lPLYNxwHaIU&pid=Api&rs=1&c=1&qlt=95&w=105&h=118","https://tse1.mm.bing.net/th?id=OIP.dJ7A1hPb-BDRBrhOmhrVAgHaHa&pid=Api&P=0&h=180","https://tse4.mm.bing.net/th?id=OIP.2x1yN8k3MVCrkJFR_C5k-wHaIp&pid=Api&P=0&h=180","https://tse1.mm.bing.net/th?id=OIP.YPYdVAg5ieRspLI6HIpmDQHaIB&pid=Api&P=0&h=180","https://tse1.mm.bing.net/th?id=OIP.pkqphAig1t-PCsy4dkVrfAHaD5&pid=Api&P=0&h=180","https://tse1.mm.bing.net/th?id=OIP.Y224uoZnCs8yY0Sos_h4cQHaDd&pid=Api&rs=1&c=1&qlt=95&w=258&h=120","https://tse4.mm.bing.net/th?id=OIP.S_9pgiKacbi3FxPKxDmusgHaFy&pid=Api&P=0&h=180","https://tse4.mm.bing.net/th?id=OIP.v5m2HW3FI3RbopnK8Cs6HgAAAA&pid=Api&P=0&h=180","https://tse4.mm.bing.net/th?id=OIP.bHt6sdtkwUqP91oPKlruGgHaEM&pid=Api&P=0&h=180","https://tse2.explicit.bing.net/th?id=OIP.tLfIejOZiP_H0Zse0NIn2QAAAA&pid=Api&P=0&h=180","https://tse3.mm.bing.net/th?id=OIP.7nKR4oRAhgtSbD97mDXWWgHaE8&pid=Api&P=0&h=180","https://tse2.mm.bing.net/th?id=OIP.cI8KflTKlnmraGFa22XpKQHaEK&pid=Api&P=0&h=180","https://tse3.mm.bing.net/th?id=OIP.gW_YaXsZmuSntd_sy5zkIwHaHa&pid=Api&P=0&h=180","https://tse2.mm.bing.net/th?id=OIP.hEP7hOlvIzhKU1fGpizd7QAAAA&pid=Api&P=0&h=180","https://tse1.mm.bing.net/th?id=OIP.XozeB5BRQSzNCO6k7om62QHaHa&pid=Api&P=0&h=180","https://tse1.mm.bing.net/th?id=OIP.2BwE10YiTSXRrnW2LnVh8wHaHa&pid=Api&P=0&h=180","https://tse3.mm.bing.net/th?id=OIP.0rg-o4mEzLO5EHJ1zS52YwHaGe&pid=Api&P=0&h=180","https://tse4.mm.bing.net/th?id=OIP.YmPfYoQK3WvGEjFXusKV9QHaHa&pid=Api&P=0&h=180"))
df_final <- left_join(df, df_logos, by = c(`Programming Language` = "lenguaje"))
df_final <- df_final %>% mutate(Logo = logo, .after = `Programming Language`)
df_final <- df_final %>% select(-5)
minimal_table_prueba <- gt(df_final) %>%
gtExtras::gt_plt_dot(column = cuota, category_column = `Programming Language`, max_value = NULL, palette = colores ) %>%
gtExtras::gt_theme_nytimes() %>%
tab_header(title = "Lenguajes de programación más populares",
subtitle = "Según el índice TIOBE.") %>%
cols_width(`Programming Language` ~ px(368), 3 ~ px(30)) %>%
gtExtras::gt_img_rows(columns = Logo, img_source = 'web')
minimal_table_prueba
Lenguajes de programación más populares | |||
Según el índice TIOBE. | |||
Dec 2023 | Programming Language | Logo | cuota |
---|---|---|---|
1 |
Python
|
13.86 | |
2 |
C
|
11.44 | |
3 |
C++
|
10.01 | |
4 |
Java
|
7.99 | |
5 |
C#
|
7.30 | |
6 |
JavaScript
|
2.90 | |
7 |
PHP
|
2.01 | |
8 |
Visual Basic
|
1.82 | |
9 |
SQL
|
1.61 | |
10 |
Assembly language
|
1.11 | |
11 |
Scratch
|
1.08 | |
12 |
Fortran
|
1.07 | |
13 |
Go
|
1.03 | |
14 |
MATLAB
|
0.93 | |
15 |
Kotlin
|
0.92 | |
16 |
Delphi/Object Pascal
|
0.92 | |
17 |
Swift
|
0.82 | |
18 |
Rust
|
0.80 | |
19 |
Ruby
|
0.77 | |
20 |
R
|
0.72 |