class: title-slide, middle, center background-image: url(data:image/png;base64,#imagenes/liigh_unam_logo.png) background-position: 10% 10% background-size: 15% .center-column[ # ManipulaciĆ³n de datos usando dplyr ### ā<br/>Nivel bĆ”sico ####Dra. Evelia Coss #### 2024/03/15 ] --- ## Paquetes necesarios Ya deben tenerlos instalados previo a la clase ```r install.packages("dplyr") # ManipulaciĆ³n de datos install.packages("tidyr") # ManipulaciĆ³n de datos install.packages("tidyverse")# ManipulaciĆ³n de datos install.packages("reshape2") # TransformaciĆ³n de datos install.packages("ggplot2") # VisualizaciĆ³n grafica install.packages("cowplot") # Generar varios graficos en una misma figura ``` --- ## Cargar paquetes ```r library(dplyr) # ManipulaciĆ³n de datos library(tidyr) # ManipulaciĆ³n de datos library(tidyverse) # ManipulaciĆ³n de datos library(reshape2) # TransformaciĆ³n de datos library(cowplot) # VisualizaciĆ³n grafica library(ggplot2) # Generar varios graficos en una misma figura ``` --- class: center, middle
# Marvel vs DC comics .center[.pull-right[ <img src = "logos/Marvel_Logo.png", height = "250">] ] .center[.pull-left[ <img src = "logos/DC-comic-1.png", height = "250">] ] --- ## Paqueterias importantes en la ManipulaciĆ³n de datos en R - Tidyverse packages - tidyr - dplyr - ggplot2 - readr - purrr - tibble - stringr - forcats Cada paquete contiene sus propias instalaciones, aunque al instalar el paquete `Tidyverse`, algunas funciones podrĆan compartirse con los demĆ”s paquetes. > **NOTA:** Cuando queremos evitar chocar entre paquetes indicamos de donde viene la funcion, ejemplo: `dplyr::select()`. Para mĆ”s informaciĆ³n pueden visitar su [sitio web](https://www.tidyverse.org/packages/). --- ## %>% pipeline Empleando el paquete `Tidyverse` y `dplyr` puedes acceder a usar `%>%`, el cual nos permitirĆ” enlazar funciones en la modificaciĆ³n de un dataframe. ```r df <- data.frame(genes = paste0("Gen", seq_len(8)), expression = c(3.8, 5.5, 6.3, 1.8, 9, rep(3,3)), treatment =c(rep("Control", 4), rep("Condicion1",4))) df %>% head() # genes expression treatment # 1 Gen1 3.8 Control # 2 Gen2 5.5 Control # 3 Gen3 6.3 Control # 4 Gen4 1.8 Control # 5 Gen5 9.0 Condicion1 # 6 Gen6 3.0 Condicion1 ``` --- ## Archivo tipo `Tibble` Cuando trabajamos con los paquetes provenientes de `Tidyverse` los archivos de salida por lo regular son tipo `tibble`, que es parecido a un dataframe, pero puede chocar con algunas paqueterias para manipulacion de dataframe. Por lo que regularmente convertimos esta salida a dataframe usando `as.data.frame()` Para mĆ”s informaciĆ³n revisa el paquete [tibble](https://tibble.tidyverse.org/). --- ## Funciones que vamos a emplear de `dplyr` .content-box-gray[ - `select()` : Seleccionar nombres de las columnas. --> select(dataframe, columna1, columna2, ... columnax) - `filter()` : Filtrar filas por una condicion especifica, apartir de la columna. --> filter(dataframe, columna1 == "condicion") - `mutate()` : Modificar o agregar columnas. --> mutate(dataframe, columna1 = "condicion") - `group_by()` : Agrupar informacion de acuerdo a un(as) columna(s) seleccionada(s). - `if_else()` : Condicional. --> if_else(dataframe, codicion, si se acepta entonces, si se rechaza entonces) - `arrange()` : Acomodar los resultados, default de menor a mayor. - `count()`: Cuenta los valores de acuerdo a una variable. - `left_join()` : Unir dos dataframe con base en una misma columna en comun. --> left_join(dataframe1, dataframe2, by = "Columna en comun, mismo nombre") - `n_distinct()` : Cuenta las filas unicas. - `distinct()` : Muestra las filas duplicadas. - `summarise()` : reduce varios valores seleccionados en un resumen. ] Para mĆ”s informaciĆ³n visita el [Github del paquete dplyr](https://github.com/cran/dplyr). Para ver todas las funciones existentes del paquete puede ver el [Cheat Sheet](https://raw.githubusercontent.com/rstudio/cheatsheets/main/pngs/thumbnails/data-transformation-cheatsheet-thumbs.png). --- ## Funciones que vamos a emplear de `reshape2` .content-box-gray[ - `melt()` : ModificaciĆ³n el formato de un dataframe. ] Para mĆ”s informaciĆ³n visita el [Github del paquete reshape2](https://github.com/cran/reshape2). Aunque este paquete se encuentra descontinuado, aun funcionan las funciones. Fue absorbido posteriormente por el paquete `tidyr`. Se supone que la funciĆ³n `gather()` del paquete `tidyr` realiza lo mismo que `melt()` del paquete `reshape2`. Hoy lo compararemos ambas. Para mĆ”s informaciĆ³n visita el [Github del paquete tidyr](https://tidyr.tidyverse.org/). --- ## Funciones para unir dataframes con el paquete `dplyr` .center[ <img src = "figures/dplyr_joins.png", height = "400">] --- class: center, middle
# En la clase anterior vimos ... --- # En la Clase 6 vimos: - **Paso 1.** Crear un RBioProject - **Paso 2.** Descargar los datos y verificar su ubicaciĆ³n en la carpeta `data/` - **Paso 3.** Importar los datos en R - **Paso 4.** Renombrar la columna Name en todos los dataframe - **Paso 5.** Seleccionar SOLO los datos de Marvel Comics y DC Comics - **Paso 6.** Eliminar duplicados - **Paso 7.** Seleccionar columnas - **Paso 8.** Cambiar formatos en algunas columnas Todos estos pasos se encuentran en el Script [MarvelvsDCComics_limpieza_script.R](https://github.com/EveliaCoss/ViernesBioinfo2024/blob/main/Practica_Clase6y7/MarvelvsDCComics_limpieza_script.R). --- class: center, middle
# ManipulaciĆ³n de datos --- ## Importar datos en R Partiendo del cĆ³digo que ya conocemos, continuamos con el **Script**. ```r ###### # Script de clase "Intro a R" # Evelia Coss # 8 de marzo 2024 ####### indir = "C:/Users/ecoss/OneDrive - CINVESTAV/Documentos/Posdoc_LIIGH/VieRnesBioinfo/ViernesBioinfo_2024/Presentaciones/data/" outdir = "C:/Users/ecoss/OneDrive - CINVESTAV/Documentos/Posdoc_LIIGH/VieRnesBioinfo/ViernesBioinfo_2024/Presentaciones/" # Cargar las variables infoPowers, infoStats, marvelDcInfo load(file = paste0(indir, "Info_data.RData")) ``` El archivo [`Info_data.RData`](https://github.com/EveliaCoss/ViernesBioinfo2024/blob/main/Practica_Clase6y7/Info_data.RData) lo creamos en la clase pasada, por ello, solo cargaremos este archivo. --- ## Paso 9. Unir dataframes con base en una columna en comĆŗn (Join Datasets) Iniciamos con 3 dataframes (`infoCharacters, infoStats` e `infoPowers`). A partir del dataframe `infoCharacters` seleccionamos solo los datos de **Marvel Comics y DC Comics**, limpiamos los duplicados y almacenamos en la variable `marvelDcInfo`. > **Primera uniĆ³n**, empleando la columna `Name` contenida en ambos dataframes. Se unieron las columnas seleccionadas con la informaciĆ³n bĆ”sica de cada personaje con los stats de cada uno. ```r marvelDcStatsInfo <- left_join(marvelDcInfo, infoStats, by = "Name") head(marvelDcStatsInfo)[1:5] # Name Gender Race Publisher Alignment # 1 A-Bomb Male Human Marvel Comics good # 2 Abin Sur Male Ungaran DC Comics good # 3 Abomination Male Human / Radiation Marvel Comics bad # 4 Abraxas Male Cosmic Entity Marvel Comics bad # 5 Absorbing Man Male Human Marvel Comics <NA> # 6 Adam Strange Male Human DC Comics good ``` --- ## Paso 9. Unir dataframes con base en una columna en comĆŗn (Join Datasets) > **Segunda uniĆ³n**, empleando la columna `Name`. Se el dataframe generado co la informacion de los poderes por cada personaje. ```r fullMarvelDc <- left_join(marvelDcStatsInfo, infoPowers, by = "Name") head(fullMarvelDc)[1:5] # Name Gender Race Publisher Alignment # 1 A-Bomb Male Human Marvel Comics good # 2 Abin Sur Male Ungaran DC Comics good # 3 Abomination Male Human / Radiation Marvel Comics bad # 4 Abraxas Male Cosmic Entity Marvel Comics bad # 5 Absorbing Man Male Human Marvel Comics <NA> # 6 Adam Strange Male Human DC Comics good ``` --- ## Paso 10. Cambiar formatos en algunas columnas ```r fullMarvelDc$Name <- as.factor(fullMarvelDc$Name) fullMarvelDc$Alignment <- as.factor(fullMarvelDc$Alignment) ``` Si usamos `str()` tendremos desplegado la informacion de todas las 179 columnas presentes en el dataframe, recuerda que puedes usar `dim()` para checar las dimensiones. ```r dim(fullMarvelDc) # [1] 586 179 ``` --- ## Verificamos los formatos con `class()` ```r class(fullMarvelDc$Name) # [1] "factor" class(fullMarvelDc$Gender) # [1] "factor" class(fullMarvelDc$Race) # [1] "factor" class(fullMarvelDc$Publisher) # [1] "factor" class(fullMarvelDc$Alignment) # [1] "factor" ``` --- class: center, middle
# Ejercicios ## Vamos a resolver juntos los siguientes ejercicios --- ## Ejercicios 1) ĀæCuĆ”ntos individuos tenemos de cada gĆ©nero (Gender), considerando su raza (Race) y empresa (Publisher)? 2) ĀæCuĆ”ntos personajes villanos, neutrales y hĆ©roes (su bando, Aligment) por cada empresa? 3) ĀæCuĆ”ntos individuos tenemos de cada gĆ©nero (Gender), considerando su bando (Aligment) y empresa (Publisher)? --- ## Ejercicios: RESPUESTAS 1) ĀæCuĆ”ntos individuos tenemos de cada gĆ©nero (Gender), considerando su raza (Race) y empresa (Publisher)? .scroll-box-14[ ```r fullMarvelDc %>% filter(!is.na(Race)) %>% group_by(Publisher, Gender) %>% dplyr::count(Race) %>% select(Publisher, Gender, Race, Count = n) %>% arrange(-Count) # ordenar de max a min # # A tibble: 72 Ć 4 # # Groups: Publisher, Gender [6] # Publisher Gender Race Count # <fct> <fct> <fct> <int> # 1 DC Comics Male Human 65 # 2 Marvel Comics Male Human 63 # 3 Marvel Comics Male Mutant 36 # 4 DC Comics Female Human 21 # 5 Marvel Comics Female Mutant 20 # 6 Marvel Comics Female Human 19 # 7 Marvel Comics Male Human / Radiation 8 # 8 Marvel Comics Male Symbiote 8 # 9 DC Comics Male God / Eternal 6 # 10 DC Comics Male Android 4 # # ā¹ 62 more rows ``` ] --- ## Ejercicios: RESPUESTAS 2) ĀæCuĆ”ntos personajes villanos, neutrales y hĆ©roes (su bando, Aligment) por cada empresa? ```r marvelDcAlignment <- fullMarvelDc %>% filter(!is.na(Alignment)) %>% group_by(Publisher) %>% dplyr::count(Alignment) %>% select(Publisher, Alignment, Count = n) %>% arrange(-Count) # ordenar de max a min marvelDcAlignment # # A tibble: 6 Ć 3 # # Groups: Publisher [2] # Publisher Alignment Count # <fct> <fct> <int> # 1 Marvel Comics good 235 # 2 DC Comics good 112 # 3 Marvel Comics bad 97 # 4 DC Comics bad 46 # 5 DC Comics neutral 6 # 6 Marvel Comics neutral 5 ``` --- ## Ejercicios: RESPUESTAS 3) ĀæCuĆ”ntos individuos tenemos de cada gĆ©nero (Gender), considerando su bando (Aligment) y empresa (Publisher)? .scroll-box-14[ ```r # Y si le agregamos sexo? fullMarvelDc %>% filter(!is.na(Alignment) & !is.na(Gender)) %>% group_by(Publisher, Gender) %>% dplyr::count(Alignment) %>% select(Publisher, Gender, Alignment, Count = n) %>% arrange(-Count) # ordenar de max a min # # A tibble: 11 Ć 4 # # Groups: Publisher, Gender [4] # Publisher Gender Alignment Count # <fct> <fct> <fct> <int> # 1 Marvel Comics Male good 135 # 2 DC Comics Male good 82 # 3 Marvel Comics Female good 82 # 4 Marvel Comics Male bad 80 # 5 DC Comics Male bad 35 # 6 DC Comics Female good 30 # 7 Marvel Comics Female bad 13 # 8 DC Comics Female bad 11 # 9 DC Comics Male neutral 5 # 10 Marvel Comics Male neutral 5 # 11 DC Comics Female neutral 1 ``` ] --- class: center, middle
# ContinuaciĆ³n de la manipulaciĆ³n de datos ## Marvel vs DC comics --- ## Esto es lo que realiza `melt()` .center[ <img src = "figures/melt_Example.png", height = "600">] --- ## Paso 11. Transformar en una sola columna los poderes usando `melt()` Reacomodar la tabla de acuerdo a las habilidades o poderes. La funciĆ³n `melt()` te permite acomodar la tabla, cambiando el formato de la misma de acuerdo a las habilidades o poderes. .scroll-box-14[ ```r marvelDc <- melt(fullMarvelDc, id = c("Name", "Gender", "Race", "Publisher", "Alignment", "Intelligence.x", "Strength", "Speed", "Durability.x", "Power", "Combat", "Total")) str(marvelDc) # 'data.frame': 97862 obs. of 14 variables: # $ Name : Factor w/ 585 levels "A-Bomb","Abin Sur",..: 1 2 3 4 5 6 7 8 9 10 ... # $ Gender : Factor w/ 2 levels "Female","Male": 2 2 2 2 2 2 1 2 2 2 ... # $ Race : Factor w/ 48 levels "Alien","Amazon",..: 20 45 26 10 20 20 NA 20 NA NA ... # $ Publisher : Factor w/ 2 levels "DC Comics","Marvel Comics": 2 1 2 2 2 1 2 2 2 2 ... # $ Alignment : Factor w/ 3 levels "bad","good","neutral": 2 2 1 1 NA 2 NA 2 2 1 ... # $ Intelligence.x: int 38 50 63 88 NA 1 NA 10 75 50 ... # $ Strength : int 100 90 80 100 NA 1 NA 8 28 85 ... # $ Speed : int 17 53 53 83 NA 1 NA 13 38 100 ... # $ Durability.x : int 80 64 90 99 NA 1 NA 5 80 85 ... # $ Power : int 17 84 55 100 NA 0 NA 5 72 100 ... # $ Combat : int 64 65 95 56 NA 1 NA 20 95 40 ... # $ Total : int 316 406 436 526 NA 5 NA 61 388 460 ... # $ variable : Factor w/ 167 levels "Agility","Accelerated.Healing",..: 1 1 1 1 1 1 1 1 1 1 ... # $ value : chr "False" "False" "False" "False" ... ``` ] --- ## Checamos los cambios en el contenido Se redujo el numero de columnas y las columnas seleccionados se compactaron en una sola columna. Se agrego la columna `value` con valores de TRUE y FALSE, considerando si el personaje tenia o no la habilidad. ```r head(marvelDc, 3) # Name Gender Race Publisher Alignment Intelligence.x # 1 A-Bomb Male Human Marvel Comics good 38 # 2 Abin Sur Male Ungaran DC Comics good 50 # 3 Abomination Male Human / Radiation Marvel Comics bad 63 # Strength Speed Durability.x Power Combat Total variable value # 1 100 17 80 17 64 316 Agility False # 2 90 53 64 84 65 406 Agility False # 3 80 53 90 55 95 436 Agility False ``` --- ## Al usar `melt()` se reduce el numero de columnas en 2 ```r dim(marvelDc) # [1] 97862 14 ``` Se redujeron de 179 columnas a 14 columnas. Creando 2 nuevas columnas: 1) `variable` : Contiene el nombre de los poderes. 2) `value` : Contiene valores lĆ³gicos de acuerdo a cada poder de los personajes. --- ## Paso 12. Renombrar la columnas ```r head(marvelDc, 3) # Name Gender Race Publisher Alignment Intelligence.x # 1 A-Bomb Male Human Marvel Comics good 38 # 2 Abin Sur Male Ungaran DC Comics good 50 # 3 Abomination Male Human / Radiation Marvel Comics bad 63 # Strength Speed Durability.x Power Combat Total variable value # 1 100 17 80 17 64 316 Agility False # 2 90 53 64 84 65 406 Agility False # 3 80 53 90 55 95 436 Agility False ``` Vamos a renombrar la columna `variable` por `SuperPower`. ```r colnames(marvelDc)[colnames(marvelDc) == "variable"] <- "SuperPower" # Renombrar columna ``` A veces el paquete `dplyr` cambia el nombre de algunas columnas solo agregando `.x`, no es preocupante y podemos corregirlo de la siguiente manera. ```r # Corregir nombres de columnas colnames(marvelDc)[colnames(marvelDc) == "Intelligence.x"] <- "Intelligence" # Renombrar columna colnames(marvelDc)[colnames(marvelDc) == "Durability.x"] <- "Durability" # Renombrar columna ``` --- ## Cambiamos el formato de las columnas En caso de que las siguientes columnas no se encuentren convertidas. ```r marvelDc$Name <- as.factor(marvelDc$Name) marvelDc$Gender <- as.factor(marvelDc$Gender) marvelDc$Race <- as.factor(marvelDc$Race) marvelDc$Publisher <- as.factor(marvelDc$Publisher) marvelDc$Alignment <- as.factor(marvelDc$Alignment) marvelDc$SuperPower <- as.factor(marvelDc$SuperPower) ``` --- ## Verificar el formato de las columnas ```r class(marvelDc$Name) # [1] "factor" class(marvelDc$Gender) # [1] "factor" class(marvelDc$Race) # [1] "factor" class(marvelDc$Publisher) # [1] "factor" class(marvelDc$Alignment) # [1] "factor" class(marvelDc$SuperPower) # [1] "factor" ``` --- ## Paso 13. SelecciĆ³n de habilidades con TRUE ```r marvelDc <- marvelDc %>% filter(value == "True") %>% select(-value) #eliminar columna head(marvelDc) # Name Gender Race Publisher Alignment Intelligence Strength Speed # 1 Ajax Male Cyborg Marvel Comics <NA> NA NA NA # 2 Amazo Male Android DC Comics bad 75 100 100 # 3 Angel Male <NA> Marvel Comics good 63 13 46 # 4 Angel Dust Female Mutant Marvel Comics <NA> NA NA NA # 5 Annihilus Male <NA> Marvel Comics bad 75 80 47 # 6 Ant-Man II Male Human Marvel Comics good 63 10 23 # Durability Power Combat Total SuperPower # 1 NA NA NA NA Agility # 2 100 100 100 575 Agility # 3 64 17 42 245 Agility # 4 NA NA NA NA Agility # 5 56 59 64 381 Agility # 6 28 32 28 184 Agility ``` --- ## Ejercicios 1) ĀæQuiĆ©nes son los personajes con mĆ”s habilidades/poderes por cada empresa? ```r marvelDc %>% group_by(Name, Publisher) %>% distinct(SuperPower) %>% dplyr::count(Publisher) %>% select(Name, Publisher, Count = n) %>% arrange(-Count) %>% # ordenar de max a min head(3) # # A tibble: 3 Ć 3 # # Groups: Name, Publisher [3] # Name Publisher Count # <fct> <fct> <int> # 1 Spectre DC Comics 49 # 2 Amazo DC Comics 44 # 3 Living Tribunal Marvel Comics 35 ``` Spectre es el personaje con mĆ”s habilidades a comparaciĆ³n de los demĆ”s personajes. > NOTA: Cuando usamos el simbolo `-` en la funcion `arrange()` para ordenar de mayor a menor los valores. --- ## Ejercicios 1) ĀæQuiĆ©nes son los personajes con mĆ”s habilidades/poderes por cada empresa? Sin embargo, ser el mĆ”s habilidoso no implica el mĆ”s poderoso...Si observamos sus stats todos son de 1 o menos. .scroll-box-14[ ```r marvelDc %>% filter(Name == "Spectre") # Name Gender Race Publisher Alignment Intelligence Strength Speed # 1 Spectre Male God / Eternal DC Comics good 1 1 1 # 2 Spectre Male God / Eternal DC Comics good 1 1 1 # 3 Spectre Male God / Eternal DC Comics good 1 1 1 # 4 Spectre Male God / Eternal DC Comics good 1 1 1 # 5 Spectre Male God / Eternal DC Comics good 1 1 1 # 6 Spectre Male God / Eternal DC Comics good 1 1 1 # 7 Spectre Male God / Eternal DC Comics good 1 1 1 # 8 Spectre Male God / Eternal DC Comics good 1 1 1 # 9 Spectre Male God / Eternal DC Comics good 1 1 1 # 10 Spectre Male God / Eternal DC Comics good 1 1 1 # 11 Spectre Male God / Eternal DC Comics good 1 1 1 # 12 Spectre Male God / Eternal DC Comics good 1 1 1 # 13 Spectre Male God / Eternal DC Comics good 1 1 1 # 14 Spectre Male God / Eternal DC Comics good 1 1 1 # 15 Spectre Male God / Eternal DC Comics good 1 1 1 # 16 Spectre Male God / Eternal DC Comics good 1 1 1 # 17 Spectre Male God / Eternal DC Comics good 1 1 1 # 18 Spectre Male God / Eternal DC Comics good 1 1 1 # 19 Spectre Male God / Eternal DC Comics good 1 1 1 # 20 Spectre Male God / Eternal DC Comics good 1 1 1 # 21 Spectre Male God / Eternal DC Comics good 1 1 1 # 22 Spectre Male God / Eternal DC Comics good 1 1 1 # 23 Spectre Male God / Eternal DC Comics good 1 1 1 # 24 Spectre Male God / Eternal DC Comics good 1 1 1 # 25 Spectre Male God / Eternal DC Comics good 1 1 1 # 26 Spectre Male God / Eternal DC Comics good 1 1 1 # 27 Spectre Male God / Eternal DC Comics good 1 1 1 # 28 Spectre Male God / Eternal DC Comics good 1 1 1 # 29 Spectre Male God / Eternal DC Comics good 1 1 1 # 30 Spectre Male God / Eternal DC Comics good 1 1 1 # 31 Spectre Male God / Eternal DC Comics good 1 1 1 # 32 Spectre Male God / Eternal DC Comics good 1 1 1 # 33 Spectre Male God / Eternal DC Comics good 1 1 1 # 34 Spectre Male God / Eternal DC Comics good 1 1 1 # 35 Spectre Male God / Eternal DC Comics good 1 1 1 # 36 Spectre Male God / Eternal DC Comics good 1 1 1 # 37 Spectre Male God / Eternal DC Comics good 1 1 1 # 38 Spectre Male God / Eternal DC Comics good 1 1 1 # 39 Spectre Male God / Eternal DC Comics good 1 1 1 # 40 Spectre Male God / Eternal DC Comics good 1 1 1 # 41 Spectre Male God / Eternal DC Comics good 1 1 1 # 42 Spectre Male God / Eternal DC Comics good 1 1 1 # 43 Spectre Male God / Eternal DC Comics good 1 1 1 # 44 Spectre Male God / Eternal DC Comics good 1 1 1 # 45 Spectre Male God / Eternal DC Comics good 1 1 1 # 46 Spectre Male God / Eternal DC Comics good 1 1 1 # 47 Spectre Male God / Eternal DC Comics good 1 1 1 # 48 Spectre Male God / Eternal DC Comics good 1 1 1 # 49 Spectre Male God / Eternal DC Comics good 1 1 1 # Durability Power Combat Total SuperPower # 1 1 0 1 5 Agility # 2 1 0 1 5 Accelerated.Healing # 3 1 0 1 5 Dimensional.Awareness # 4 1 0 1 5 Stealth # 5 1 0 1 5 Energy.Absorption # 6 1 0 1 5 Flight # 7 1 0 1 5 Marksmanship # 8 1 0 1 5 Longevity # 9 1 0 1 5 Intelligence.y # 10 1 0 1 5 Super.Strength # 11 1 0 1 5 Telepathy # 12 1 0 1 5 Energy.Blasts # 13 1 0 1 5 Duplication # 14 1 0 1 5 Size.Changing # 15 1 0 1 5 Density.Control # 16 1 0 1 5 Stamina # 17 1 0 1 5 Super.Speed # 18 1 0 1 5 Possession # 19 1 0 1 5 Electrokinesis # 20 1 0 1 5 Darkforce.Manipulation # 21 1 0 1 5 Death.Touch # 22 1 0 1 5 Teleportation # 23 1 0 1 5 Magic # 24 1 0 1 5 Immortality # 25 1 0 1 5 Phasing # 26 1 0 1 5 Astral.Projection # 27 1 0 1 5 Fire.Control # 28 1 0 1 5 Invulnerability # 29 1 0 1 5 Energy.Constructs # 30 1 0 1 5 Force.Fields # 31 1 0 1 5 Psionic.Powers # 32 1 0 1 5 Elasticity # 33 1 0 1 5 Animation # 34 1 0 1 5 Precognition # 35 1 0 1 5 Hypnokinesis # 36 1 0 1 5 Animal.Control # 37 1 0 1 5 Heat.Generation # 38 1 0 1 5 Gravity.Control # 39 1 0 1 5 Light.Control # 40 1 0 1 5 Levitation # 41 1 0 1 5 Time.Travel # 42 1 0 1 5 Illusions # 43 1 0 1 5 Water.Control # 44 1 0 1 5 Omnilingualism # 45 1 0 1 5 Time.Manipulation # 46 1 0 1 5 Invisibility # 47 1 0 1 5 Sub.Mariner # 48 1 0 1 5 Vision...Heat # 49 1 0 1 5 Reality.Warping ``` ] Es el personaje con mĆ”s habilidades, pero tiene sus stats muy bajos. --- ## Ejercicios 2) ĀæQuiĆ©nes son los personajes con los stats mĆ”s altos por cada empresa? ```r marvelDc %>% arrange(-Intelligence, -Strength, -Speed, -Durability, -Power, -Combat) %>% select(-SuperPower) %>% distinct() %>% head(5) # Name Gender Race Publisher Alignment Intelligence # 1 Mister Mxyzptlk Male God / Eternal DC Comics bad 113 # 2 Superman Male Kryptonian DC Comics good 100 # 3 Martian Manhunter Male Martian DC Comics good 100 # 4 Galactus Male Cosmic Entity Marvel Comics neutral 100 # 5 Captain Marvel Female Human-Kree Marvel Comics good 100 # Strength Speed Durability Power Combat Total # 1 10 12 14 100 28 277 # 2 100 100 100 94 85 579 # 3 100 96 100 100 85 581 # 4 100 83 100 100 70 553 # 5 100 67 95 62 56 480 ``` > NOTA: Cuando usamos el simbolo `-` en la funcion `select()` estamos eliminando la columna SuperPower. --- ## Ejercicios 3) ĀæExiste algĆŗn personaje que tenga todos sus stats en 100? Hay 6 columnas de stats evaluados que sumados nos da la columna Total, osea que los valores maximos se encuentran cercanos a 600 (columnas 6:11). ```r # Opcion B marvelDc %>% select(-SuperPower) %>% distinct() %>% # eliminas duplicados filter(Intelligence >= 100 & Strength >= 100 & Speed >= 100 & Durability >= 100 & Power >= 100 & Combat >= 100) # [1] Name Gender Race Publisher Alignment # [6] Intelligence Strength Speed Durability Power # [11] Combat Total # <0 rows> (or 0-length row.names) ``` La salida da NINGUNO, ya que no existe un personaje que tenga los 6 Stats con valores de 100. --- ## Ejercicios Vamos a disminuir el filtro en valores cercanos o iguales a 90. ```r # Personaje con stats superiores a 90 en cada uno marvelDc %>% select(-SuperPower) %>% distinct() %>% # eliminas duplicados filter(Intelligence >= 90 & Strength >= 90 & Speed >= 90 & Durability >= 90 & Power >= 90 & Combat >= 90) # Name Gender Race Publisher Alignment Intelligence Strength Speed # 1 General Zod Male Kryptonian DC Comics bad 94 100 96 # Durability Power Combat Total # 1 100 94 95 579 ``` --- ## Ejercicios Y si filtramos por el valor total ... ```r # Y si filtramos # Personas con valores totales superiores a 570 marvelDc %>% select(-SuperPower) %>% distinct() %>% # eliminas duplicados filter(Total >= 570) # Name Gender Race Publisher Alignment Intelligence Strength # 1 Amazo Male Android DC Comics bad 75 100 # 2 Martian Manhunter Male Martian DC Comics good 100 100 # 3 Superman Male Kryptonian DC Comics good 100 100 # 4 General Zod Male Kryptonian DC Comics bad 94 100 # 5 Superboy-Prime Male Kryptonian DC Comics bad 94 100 # Speed Durability Power Combat Total # 1 100 100 100 100 575 # 2 96 100 100 85 581 # 3 100 100 94 85 579 # 4 96 100 94 95 579 # 5 100 100 100 85 579 ``` --- ## Paso 14. Renombrar el formato de Alignment Cuando usamos la funciĆ³n `if_else()` la empleamos para asignar valores de acuerdo a una conducional. - Usage: if_else(condiciĆ³n, TRUE, FALSE) - CondiciĆ³n: Selecciona una columna y verifica que debe cumplir la misma. - TRUE: En caso de que la condiciĆ³n sea VERDADERA, que acciĆ³n debe hacer. - FALSE: En caso de que la condiciĆ³n sea FALSA, que acciĆ³n debe hacer Vamos agregar una nueva columna y vamos a cambiar los valores a usar el bando (Aligment) ```r # Opcion A - FunciĆ³n `if_else()` marvelDc_edited <- marvelDc %>% mutate(Group = if_else(Alignment == "good", "hero", # Primer if_else if_else(Alignment == "bad","villain", "neutral"))) # Segundo if_else ``` Tambien podemos usar `case_when()` ```r # Opcion B - Funcion `case_when()` marvelDc_edited <- marvelDc %>% mutate(Group = case_when(Alignment == "good" ~ "hero", Alignment == "bad" ~ "villain", TRUE ~ "neutral")) ``` --- ## Ejercicio: FunciĆ³n `if_else()` ĀæQuiĆ©nes son los hombres mĆ”s poderosos y malvados? ```r marvelDc_edited %>% select(-SuperPower) %>% distinct() %>% # eliminas duplicados filter(Gender == "Male" & Group == "villain") %>% arrange(-Total) # Name Gender Race Publisher Alignment # 1 General Zod Male Kryptonian DC Comics bad # 2 Superboy-Prime Male Kryptonian DC Comics bad # 3 Amazo Male Android DC Comics bad # 4 Dormammu Male <NA> Marvel Comics bad # 5 Doomsday Male Alien DC Comics bad # 6 Cyborg Superman Male Cyborg DC Comics bad # 7 Magus Male <NA> Marvel Comics bad # 8 Abraxas Male Cosmic Entity Marvel Comics bad # 9 Black Adam Male <NA> DC Comics bad # 10 Fallen One II Male <NA> Marvel Comics bad # 11 Darkseid Male New God DC Comics bad # 12 Onslaught Male Mutant Marvel Comics bad # 13 Match Male <NA> DC Comics bad # 14 Anti-Monitor Male God / Eternal DC Comics bad # 15 Apocalypse Male Mutant Marvel Comics bad # 16 Lobo Male Czarnian DC Comics bad # 17 Thanos Male Eternal Marvel Comics bad # 18 Ultron Male Android Marvel Comics bad # 19 Destroyer Male <NA> Marvel Comics bad # 20 Air-Walker Male <NA> Marvel Comics bad # 21 Carnage Male Symbiote Marvel Comics bad # 22 Magneto Male Mutant Marvel Comics bad # 23 Mephisto Male <NA> Marvel Comics bad # 24 Venom Male Symbiote Marvel Comics bad # 25 Abomination Male Human / Radiation Marvel Comics bad # 26 Doctor Doom Male Human Marvel Comics bad # 27 Sinestro Male Korugaran DC Comics bad # 28 Loki Male Asgardian Marvel Comics bad # 29 Kang Male <NA> Marvel Comics bad # 30 Brainiac Male Android DC Comics bad # 31 Swamp Thing Male God / Eternal DC Comics bad # 32 Metallo Male Android DC Comics bad # 33 Venom III Male Symbiote Marvel Comics bad # 34 Annihilus Male <NA> Marvel Comics bad # 35 Iron Monger Male <NA> Marvel Comics bad # 36 Scorpion Male Human Marvel Comics bad # 37 Utgard-Loki Male Frost Giant Marvel Comics bad # 38 Mandarin Male Human Marvel Comics bad # 39 Doppelganger Male <NA> Marvel Comics bad # 40 Mach-IV Male <NA> Marvel Comics bad # 41 Azazel Male Neyaphem Marvel Comics bad # 42 Exodus Male Mutant Marvel Comics bad # 43 Bane Male Human DC Comics bad # 44 Rhino Male Human / Radiation Marvel Comics bad # 45 Klaw Male Human Marvel Comics bad # 46 Sabretooth Male Mutant Marvel Comics bad # 47 Molten Man Male <NA> Marvel Comics bad # 48 Venom II Male <NA> Marvel Comics bad # 49 Ra's Al Ghul Male Human DC Comics bad # 50 Evilhawk Male Alien Marvel Comics bad # 51 Blackout Male Demon Marvel Comics bad # 52 Solomon Grundy Male Zombie DC Comics bad # 53 Electro Male Human Marvel Comics bad # 54 Morlun Male <NA> Marvel Comics bad # 55 Blob Male <NA> Marvel Comics bad # 56 Gog Male <NA> DC Comics bad # 57 Junkpile Male Mutant Marvel Comics bad # 58 Joker Male Human DC Comics bad # 59 Demogoblin Male Demon Marvel Comics bad # 60 Zoom Male <NA> DC Comics bad # 61 Killer Croc Male Metahuman DC Comics bad # 62 Shocker Male Human Marvel Comics bad # 63 Vanisher Male <NA> Marvel Comics bad # 64 Vulture Male Human Marvel Comics bad # 65 Kraven the Hunter Male Human Marvel Comics bad # 66 Lizard Male Human Marvel Comics bad # 67 Green Goblin II Male <NA> Marvel Comics bad # 68 Mister Mxyzptlk Male God / Eternal DC Comics bad # 69 Green Goblin Male Human Marvel Comics bad # 70 Hydro-Man Male <NA> Marvel Comics bad # 71 Tiger Shark Male Human Marvel Comics bad # 72 Moses Magnum Male <NA> Marvel Comics bad # 73 Changeling Male <NA> Marvel Comics bad # 74 Rick Flag Male <NA> DC Comics bad # 75 Kraven II Male Human Marvel Comics bad # 76 Mister Freeze Male Human DC Comics bad # 77 Bullseye Male Human Marvel Comics bad # 78 Deadshot Male Human DC Comics bad # 79 Leader Male <NA> Marvel Comics bad # 80 Lightning Lord Male <NA> DC Comics bad # 81 Big Man Male <NA> Marvel Comics bad # 82 Proto-Goblin Male <NA> Marvel Comics bad # 83 Blizzard II Male <NA> Marvel Comics bad # 84 Scarecrow Male Human DC Comics bad # 85 Warp Male <NA> DC Comics bad # 86 Red Skull Male <NA> Marvel Comics bad # 87 Penguin Male Human DC Comics bad # 88 Kevin 11 Male Human DC Comics bad # 89 Chameleon Male <NA> DC Comics bad # 90 Blackwing Male <NA> Marvel Comics bad # 91 Lex Luthor Male Human DC Comics bad # 92 Tinkerer Male <NA> Marvel Comics bad # 93 Walrus Male Human Marvel Comics bad # 94 Riddler Male <NA> DC Comics bad # 95 Pyro Male <NA> Marvel Comics bad # 96 Doctor Doom II Male <NA> Marvel Comics bad # 97 Doctor Octopus Male Human Marvel Comics bad # 98 Weapon XI Male <NA> Marvel Comics bad # 99 Mister Sinister Male Human / Altered Marvel Comics bad # 100 Bloodwraith Male <NA> Marvel Comics bad # 101 Bird-Man Male Human Marvel Comics bad # 102 Bird-Man II Male Human Marvel Comics bad # 103 Ammo Male Human Marvel Comics bad # 104 Hobgoblin Male <NA> Marvel Comics bad # 105 Blizzard Male <NA> Marvel Comics bad # 106 Black Abbott Male <NA> Marvel Comics bad # 107 Razor-Fist II Male <NA> Marvel Comics bad # Intelligence Strength Speed Durability Power Combat Total Group # 1 94 100 96 100 94 95 579 villain # 2 94 100 100 100 100 85 579 villain # 3 75 100 100 100 100 100 575 villain # 4 88 95 83 100 100 80 546 villain # 5 88 80 67 120 100 90 545 villain # 6 75 93 92 100 100 80 540 villain # 7 88 100 70 99 100 74 531 villain # 8 88 100 83 99 100 56 526 villain # 9 88 100 92 100 89 56 525 villain # 10 88 85 83 100 100 56 512 villain # 11 88 100 23 100 100 95 506 villain # 12 88 85 47 100 100 85 505 villain # 13 75 95 83 85 90 70 498 villain # 14 88 90 38 90 100 90 496 villain # 15 100 100 33 100 100 60 493 villain # 16 88 83 35 100 95 85 486 villain # 17 88 100 17 100 100 80 485 villain # 18 88 83 42 100 100 64 477 villain # 19 50 95 58 98 90 70 461 villain # 20 50 85 100 85 100 40 460 villain # 21 63 63 70 84 81 90 451 villain # 22 88 80 27 84 91 80 450 villain # 23 88 85 35 95 100 42 445 villain # 24 75 57 65 84 79 84 444 villain # 25 63 80 53 90 55 95 436 villain # 26 100 32 20 100 93 84 429 villain # 27 75 80 53 64 100 56 428 villain # 28 88 57 47 85 85 56 418 villain # 29 100 48 58 70 71 70 417 villain # 30 100 28 63 90 60 75 416 villain # 31 88 80 23 100 66 56 413 villain # 32 75 53 23 95 74 64 384 villain # 33 63 73 35 90 66 56 383 villain # 34 75 80 47 56 59 64 381 villain # 35 88 63 25 90 57 56 379 villain # 36 50 52 60 85 49 80 376 villain # 37 50 80 23 84 72 64 373 villain # 38 100 28 23 28 99 95 373 villain # 39 8 63 60 95 62 84 372 villain # 40 75 36 60 84 60 56 371 villain # 41 50 11 47 95 87 80 370 villain # 42 63 81 28 28 100 70 370 villain # 43 88 53 23 56 51 95 366 villain # 44 25 80 43 90 37 85 360 villain # 45 63 38 33 100 62 60 356 villain # 46 55 53 25 90 28 100 351 villain # 47 50 73 23 84 53 56 339 villain # 48 50 57 47 70 54 56 334 villain # 49 100 28 32 42 27 100 329 villain # 50 50 32 33 70 78 64 327 villain # 51 63 32 45 80 38 65 323 villain # 52 9 93 13 100 78 30 323 villain # 53 69 10 50 56 67 64 316 villain # 54 63 60 35 42 59 56 315 villain # 55 10 83 23 95 26 72 309 villain # 56 50 34 47 72 39 56 298 villain # 57 50 38 17 90 71 30 296 villain # 58 100 10 12 56 22 90 290 villain # 59 50 48 42 35 54 60 289 villain # 60 50 10 100 28 72 28 288 villain # 61 25 48 33 85 36 60 287 villain # 62 63 10 23 70 63 56 285 villain # 63 63 10 75 56 39 42 285 villain # 64 63 22 47 56 40 56 284 villain # 65 63 32 35 42 26 85 283 villain # 66 38 51 27 70 40 56 282 villain # 67 75 55 37 50 38 26 281 villain # 68 113 10 12 14 100 28 277 villain # 69 75 48 35 48 38 28 272 villain # 70 38 13 25 80 66 50 272 villain # 71 38 72 42 70 21 28 271 villain # 72 75 28 12 42 55 56 268 villain # 73 63 10 23 42 64 64 266 villain # 74 88 11 23 28 19 95 264 villain # 75 50 34 23 28 36 85 256 villain # 76 75 32 12 70 37 28 254 villain # 77 50 11 25 70 20 70 246 villain # 78 50 10 23 28 47 80 238 villain # 79 100 10 12 14 58 42 236 villain # 80 44 10 23 42 66 42 227 villain # 81 75 12 23 28 19 70 227 villain # 82 63 38 23 48 22 28 222 villain # 83 38 10 27 42 47 56 220 villain # 84 81 10 12 14 48 50 215 villain # 85 38 10 23 28 63 50 212 villain # 86 75 10 12 14 19 80 210 villain # 87 75 10 12 28 30 45 200 villain # 88 25 7 12 14 100 40 198 villain # 89 88 10 12 28 28 28 194 villain # 90 38 10 35 32 20 56 191 villain # 91 100 10 12 14 10 28 174 villain # 92 100 10 23 14 10 14 171 villain # 93 50 28 8 50 11 20 167 villain # 94 100 10 12 14 10 14 160 villain # 95 38 10 12 14 50 28 152 villain # 96 1 32 1 1 0 1 36 villain # 97 1 1 1 1 0 1 5 villain # 98 1 1 1 1 0 1 5 villain # 99 1 1 1 1 0 1 5 villain # 100 1 1 1 1 0 1 5 villain # 101 1 1 1 1 0 1 5 villain # 102 1 1 1 1 0 1 5 villain # 103 1 1 1 1 0 1 5 villain # 104 1 1 1 1 0 1 5 villain # 105 1 1 1 1 0 1 5 villain # 106 1 1 1 1 0 1 5 villain # 107 1 1 1 1 0 1 5 villain ``` --- # Guardar el output Vamos a almacenar la variable `marvelDc_edited` la cual ya se encuentra limpia de duplicados y mantiene todas las ediciones que le hemos hecho. ```r save(marvelDc_edited, file = "Presentaciones/data/marvelDc_edited.RData") ``` --- ## En esta clase vimos: - **Paso 9.** Unir dataframes con base en una columna en comĆŗn (Join Datasets) - **Paso 10.** Cambiar formatos en algunas columnas - **Paso 11.** Transformar en una sola columna los poderes usando `melt()` - **Paso 12.** Renombrar la columnas - **Paso 13.** SelecciĆ³n de habilidades con TRUE - **Paso 14.** Renombrar el formato de Alignment Todos estos pasos se encuentran en el script [MarvelvsDCComics_Join_script.R](https://github.com/EveliaCoss/ViernesBioinfo2024/blob/main/Practica_Clase6y7/MarvelvsDCComics_Join_script.R). --- class: center, middle
# Ejercicios de ManipulaciĆ³n de datos ## Trabajo en equipo o individual 20 min para terminar todos los ejercicios por equipo --- ## Ejercicios 1) ĀæQuiĆ©nes son los personajes mĆ”s fuertes de cada empresa? 2) ĀæQuiĆ©nes son los personajes mĆ”s inteligentes de cada empresa? 3) ĀæQuiĆ©nes son las mujeres mĆ”s poderosas y malvadas? 4) ĀæQuiĆ©nes son los hombres mĆ”s poderosos y malvados? --- ## Ejercicios: RESPUESTAS 1) ĀæQuiĆ©nes son los personajes mĆ”s fuertes de cada empresa? ```r marvelDc %>% filter(!is.na(Strength)) %>% # filtrar NA group_by(Name, Publisher) %>% # Agrupar por nombre del heroe y empresa distinct(Strength) %>% # Eliminar duplicados en la columna, para tener solo un valor por personaje select(Name, Publisher, Strength) %>% # seleccionar columnas arrange(-Strength) %>% # Ordenar de mayor a menor head(5) # # A tibble: 5 Ć 3 # # Groups: Name, Publisher [5] # Name Publisher Strength # <fct> <fct> <int> # 1 Amazo DC Comics 100 # 2 Apocalypse Marvel Comics 100 # 3 Captain Marvel Marvel Comics 100 # 4 Darkseid DC Comics 100 # 5 Hulk Marvel Comics 100 ``` --- ## Ejercicios: RESPUESTAS 2) ĀæQuiĆ©nes son los personajes mĆ”s inteligentes de cada empresa? ```r marvelDc %>% filter(!is.na(Intelligence)) %>% # filtrar NA group_by(Name, Publisher) %>% distinct(Intelligence) %>% # eliminar duplicados select(Name, Publisher, Intelligence) %>% arrange(-Intelligence) %>% # Ordenar de mayor a menor head(5) # # A tibble: 5 Ć 3 # # Groups: Name, Publisher [5] # Name Publisher Intelligence # <fct> <fct> <int> # 1 Mister Mxyzptlk DC Comics 113 # 2 Apocalypse Marvel Comics 100 # 3 Batman DC Comics 100 # 4 Captain Marvel Marvel Comics 100 # 5 Martian Manhunter DC Comics 100 ``` --- ## Ejercicios: RESPUESTAS 3) ĀæQuiĆ©nes son las mujeres mĆ”s poderosas y malvadas? .scroll-box-14[ ```r # con filtro marvelDc %>% select(-SuperPower) %>% distinct() %>% # eliminas duplicados filter(Total >= 500 & Gender == "Female" & Alignment == "bad") # Name Gender Race Publisher Alignment Intelligence Strength Speed # 1 Faora Female Kryptonian DC Comics bad 88 95 75 # Durability Power Combat Total # 1 100 87 90 535 # sin filtro marvelDc %>% select(-SuperPower) %>% distinct() %>% # eliminas duplicados filter(Gender == "Female" & Alignment == "bad") %>% arrange(-Total) # Name Gender Race Publisher Alignment Intelligence # 1 Faora Female Kryptonian DC Comics bad 88 # 2 Bloodaxe Female Human Marvel Comics bad 63 # 3 Maxima Female <NA> DC Comics bad 75 # 4 Giganta Female <NA> DC Comics bad 81 # 5 Frenzy Female <NA> Marvel Comics bad 63 # 6 Callisto Female <NA> Marvel Comics bad 63 # 7 Mystique Female Mutant Marvel Comics bad 75 # 8 Black Mamba Female <NA> Marvel Comics bad 75 # 9 Arclight Female <NA> Marvel Comics bad 38 # 10 Harley Quinn Female Human DC Comics bad 81 # 11 Scarlet Witch Female Mutant Marvel Comics bad 88 # 12 Goblin Queen Female <NA> Marvel Comics bad 75 # 13 Poison Ivy Female Human DC Comics bad 69 # 14 Siryn Female <NA> Marvel Comics bad 38 # 15 Plastique Female <NA> DC Comics bad 50 # 16 Scorpia Female <NA> Marvel Comics bad 38 # 17 Siren Female Atlantean DC Comics bad 38 # 18 Cheetah II Female Human DC Comics bad 1 # 19 Cheetah III Female Human DC Comics bad 1 # 20 Lady Deathstrike Female Cyborg Marvel Comics bad 1 # 21 Spider-Woman IV Female <NA> Marvel Comics bad 1 # 22 Granny Goodness Female <NA> DC Comics bad 1 # 23 Siren II Female <NA> DC Comics bad 1 # 24 Lady Bullseye Female <NA> Marvel Comics bad 1 # Strength Speed Durability Power Combat Total # 1 95 75 100 87 90 535 # 2 80 33 80 84 84 424 # 3 90 35 56 67 75 398 # 4 89 23 85 32 42 352 # 5 53 35 100 38 52 341 # 6 53 23 42 45 85 311 # 7 12 23 64 58 74 306 # 8 10 35 42 78 65 305 # 9 63 23 42 52 70 288 # 10 12 23 42 30 80 268 # 11 10 23 42 67 28 258 # 12 10 23 28 65 56 257 # 13 14 23 14 71 36 227 # 14 8 47 28 50 42 213 # 15 10 23 28 60 42 213 # 16 28 42 28 34 28 198 # 17 10 12 14 55 28 157 # 18 1 1 1 0 1 5 # 19 1 1 1 0 1 5 # 20 1 1 1 0 1 5 # 21 1 1 1 0 1 5 # 22 1 1 1 0 1 5 # 23 1 1 1 0 1 5 # 24 1 1 1 0 1 5 ``` ] --- ## Ejercicios: RESPUESTAS 4) ĀæQuiĆ©nes son los hombres mĆ”s poderosos y malvados? .scroll-box-14[ ```r # sin filtro marvelDc %>% select(-SuperPower) %>% distinct() %>% # eliminas duplicados filter(Gender == "Male" & Alignment == "bad") %>% arrange(-Total) # Name Gender Race Publisher Alignment # 1 General Zod Male Kryptonian DC Comics bad # 2 Superboy-Prime Male Kryptonian DC Comics bad # 3 Amazo Male Android DC Comics bad # 4 Dormammu Male <NA> Marvel Comics bad # 5 Doomsday Male Alien DC Comics bad # 6 Cyborg Superman Male Cyborg DC Comics bad # 7 Magus Male <NA> Marvel Comics bad # 8 Abraxas Male Cosmic Entity Marvel Comics bad # 9 Black Adam Male <NA> DC Comics bad # 10 Fallen One II Male <NA> Marvel Comics bad # 11 Darkseid Male New God DC Comics bad # 12 Onslaught Male Mutant Marvel Comics bad # 13 Match Male <NA> DC Comics bad # 14 Anti-Monitor Male God / Eternal DC Comics bad # 15 Apocalypse Male Mutant Marvel Comics bad # 16 Lobo Male Czarnian DC Comics bad # 17 Thanos Male Eternal Marvel Comics bad # 18 Ultron Male Android Marvel Comics bad # 19 Destroyer Male <NA> Marvel Comics bad # 20 Air-Walker Male <NA> Marvel Comics bad # 21 Carnage Male Symbiote Marvel Comics bad # 22 Magneto Male Mutant Marvel Comics bad # 23 Mephisto Male <NA> Marvel Comics bad # 24 Venom Male Symbiote Marvel Comics bad # 25 Abomination Male Human / Radiation Marvel Comics bad # 26 Doctor Doom Male Human Marvel Comics bad # 27 Sinestro Male Korugaran DC Comics bad # 28 Loki Male Asgardian Marvel Comics bad # 29 Kang Male <NA> Marvel Comics bad # 30 Brainiac Male Android DC Comics bad # 31 Swamp Thing Male God / Eternal DC Comics bad # 32 Metallo Male Android DC Comics bad # 33 Venom III Male Symbiote Marvel Comics bad # 34 Annihilus Male <NA> Marvel Comics bad # 35 Iron Monger Male <NA> Marvel Comics bad # 36 Scorpion Male Human Marvel Comics bad # 37 Utgard-Loki Male Frost Giant Marvel Comics bad # 38 Mandarin Male Human Marvel Comics bad # 39 Doppelganger Male <NA> Marvel Comics bad # 40 Mach-IV Male <NA> Marvel Comics bad # 41 Azazel Male Neyaphem Marvel Comics bad # 42 Exodus Male Mutant Marvel Comics bad # 43 Bane Male Human DC Comics bad # 44 Rhino Male Human / Radiation Marvel Comics bad # 45 Klaw Male Human Marvel Comics bad # 46 Sabretooth Male Mutant Marvel Comics bad # 47 Molten Man Male <NA> Marvel Comics bad # 48 Venom II Male <NA> Marvel Comics bad # 49 Ra's Al Ghul Male Human DC Comics bad # 50 Evilhawk Male Alien Marvel Comics bad # 51 Blackout Male Demon Marvel Comics bad # 52 Solomon Grundy Male Zombie DC Comics bad # 53 Electro Male Human Marvel Comics bad # 54 Morlun Male <NA> Marvel Comics bad # 55 Blob Male <NA> Marvel Comics bad # 56 Gog Male <NA> DC Comics bad # 57 Junkpile Male Mutant Marvel Comics bad # 58 Joker Male Human DC Comics bad # 59 Demogoblin Male Demon Marvel Comics bad # 60 Zoom Male <NA> DC Comics bad # 61 Killer Croc Male Metahuman DC Comics bad # 62 Shocker Male Human Marvel Comics bad # 63 Vanisher Male <NA> Marvel Comics bad # 64 Vulture Male Human Marvel Comics bad # 65 Kraven the Hunter Male Human Marvel Comics bad # 66 Lizard Male Human Marvel Comics bad # 67 Green Goblin II Male <NA> Marvel Comics bad # 68 Mister Mxyzptlk Male God / Eternal DC Comics bad # 69 Green Goblin Male Human Marvel Comics bad # 70 Hydro-Man Male <NA> Marvel Comics bad # 71 Tiger Shark Male Human Marvel Comics bad # 72 Moses Magnum Male <NA> Marvel Comics bad # 73 Changeling Male <NA> Marvel Comics bad # 74 Rick Flag Male <NA> DC Comics bad # 75 Kraven II Male Human Marvel Comics bad # 76 Mister Freeze Male Human DC Comics bad # 77 Bullseye Male Human Marvel Comics bad # 78 Deadshot Male Human DC Comics bad # 79 Leader Male <NA> Marvel Comics bad # 80 Lightning Lord Male <NA> DC Comics bad # 81 Big Man Male <NA> Marvel Comics bad # 82 Proto-Goblin Male <NA> Marvel Comics bad # 83 Blizzard II Male <NA> Marvel Comics bad # 84 Scarecrow Male Human DC Comics bad # 85 Warp Male <NA> DC Comics bad # 86 Red Skull Male <NA> Marvel Comics bad # 87 Penguin Male Human DC Comics bad # 88 Kevin 11 Male Human DC Comics bad # 89 Chameleon Male <NA> DC Comics bad # 90 Blackwing Male <NA> Marvel Comics bad # 91 Lex Luthor Male Human DC Comics bad # 92 Tinkerer Male <NA> Marvel Comics bad # 93 Walrus Male Human Marvel Comics bad # 94 Riddler Male <NA> DC Comics bad # 95 Pyro Male <NA> Marvel Comics bad # 96 Doctor Doom II Male <NA> Marvel Comics bad # 97 Doctor Octopus Male Human Marvel Comics bad # 98 Weapon XI Male <NA> Marvel Comics bad # 99 Mister Sinister Male Human / Altered Marvel Comics bad # 100 Bloodwraith Male <NA> Marvel Comics bad # 101 Bird-Man Male Human Marvel Comics bad # 102 Bird-Man II Male Human Marvel Comics bad # 103 Ammo Male Human Marvel Comics bad # 104 Hobgoblin Male <NA> Marvel Comics bad # 105 Blizzard Male <NA> Marvel Comics bad # 106 Black Abbott Male <NA> Marvel Comics bad # 107 Razor-Fist II Male <NA> Marvel Comics bad # Intelligence Strength Speed Durability Power Combat Total # 1 94 100 96 100 94 95 579 # 2 94 100 100 100 100 85 579 # 3 75 100 100 100 100 100 575 # 4 88 95 83 100 100 80 546 # 5 88 80 67 120 100 90 545 # 6 75 93 92 100 100 80 540 # 7 88 100 70 99 100 74 531 # 8 88 100 83 99 100 56 526 # 9 88 100 92 100 89 56 525 # 10 88 85 83 100 100 56 512 # 11 88 100 23 100 100 95 506 # 12 88 85 47 100 100 85 505 # 13 75 95 83 85 90 70 498 # 14 88 90 38 90 100 90 496 # 15 100 100 33 100 100 60 493 # 16 88 83 35 100 95 85 486 # 17 88 100 17 100 100 80 485 # 18 88 83 42 100 100 64 477 # 19 50 95 58 98 90 70 461 # 20 50 85 100 85 100 40 460 # 21 63 63 70 84 81 90 451 # 22 88 80 27 84 91 80 450 # 23 88 85 35 95 100 42 445 # 24 75 57 65 84 79 84 444 # 25 63 80 53 90 55 95 436 # 26 100 32 20 100 93 84 429 # 27 75 80 53 64 100 56 428 # 28 88 57 47 85 85 56 418 # 29 100 48 58 70 71 70 417 # 30 100 28 63 90 60 75 416 # 31 88 80 23 100 66 56 413 # 32 75 53 23 95 74 64 384 # 33 63 73 35 90 66 56 383 # 34 75 80 47 56 59 64 381 # 35 88 63 25 90 57 56 379 # 36 50 52 60 85 49 80 376 # 37 50 80 23 84 72 64 373 # 38 100 28 23 28 99 95 373 # 39 8 63 60 95 62 84 372 # 40 75 36 60 84 60 56 371 # 41 50 11 47 95 87 80 370 # 42 63 81 28 28 100 70 370 # 43 88 53 23 56 51 95 366 # 44 25 80 43 90 37 85 360 # 45 63 38 33 100 62 60 356 # 46 55 53 25 90 28 100 351 # 47 50 73 23 84 53 56 339 # 48 50 57 47 70 54 56 334 # 49 100 28 32 42 27 100 329 # 50 50 32 33 70 78 64 327 # 51 63 32 45 80 38 65 323 # 52 9 93 13 100 78 30 323 # 53 69 10 50 56 67 64 316 # 54 63 60 35 42 59 56 315 # 55 10 83 23 95 26 72 309 # 56 50 34 47 72 39 56 298 # 57 50 38 17 90 71 30 296 # 58 100 10 12 56 22 90 290 # 59 50 48 42 35 54 60 289 # 60 50 10 100 28 72 28 288 # 61 25 48 33 85 36 60 287 # 62 63 10 23 70 63 56 285 # 63 63 10 75 56 39 42 285 # 64 63 22 47 56 40 56 284 # 65 63 32 35 42 26 85 283 # 66 38 51 27 70 40 56 282 # 67 75 55 37 50 38 26 281 # 68 113 10 12 14 100 28 277 # 69 75 48 35 48 38 28 272 # 70 38 13 25 80 66 50 272 # 71 38 72 42 70 21 28 271 # 72 75 28 12 42 55 56 268 # 73 63 10 23 42 64 64 266 # 74 88 11 23 28 19 95 264 # 75 50 34 23 28 36 85 256 # 76 75 32 12 70 37 28 254 # 77 50 11 25 70 20 70 246 # 78 50 10 23 28 47 80 238 # 79 100 10 12 14 58 42 236 # 80 44 10 23 42 66 42 227 # 81 75 12 23 28 19 70 227 # 82 63 38 23 48 22 28 222 # 83 38 10 27 42 47 56 220 # 84 81 10 12 14 48 50 215 # 85 38 10 23 28 63 50 212 # 86 75 10 12 14 19 80 210 # 87 75 10 12 28 30 45 200 # 88 25 7 12 14 100 40 198 # 89 88 10 12 28 28 28 194 # 90 38 10 35 32 20 56 191 # 91 100 10 12 14 10 28 174 # 92 100 10 23 14 10 14 171 # 93 50 28 8 50 11 20 167 # 94 100 10 12 14 10 14 160 # 95 38 10 12 14 50 28 152 # 96 1 32 1 1 0 1 36 # 97 1 1 1 1 0 1 5 # 98 1 1 1 1 0 1 5 # 99 1 1 1 1 0 1 5 # 100 1 1 1 1 0 1 5 # 101 1 1 1 1 0 1 5 # 102 1 1 1 1 0 1 5 # 103 1 1 1 1 0 1 5 # 104 1 1 1 1 0 1 5 # 105 1 1 1 1 0 1 5 # 106 1 1 1 1 0 1 5 # 107 1 1 1 1 0 1 5 # Y bueno ? marvelDc %>% select(-SuperPower) %>% distinct() %>% # eliminas duplicados filter(Gender == "Male" & Alignment == "good") %>% arrange(-Total) # Name Gender Race Publisher Alignment # 1 Martian Manhunter Male Martian DC Comics good # 2 Superman Male Kryptonian DC Comics good # 3 Stardust Male <NA> Marvel Comics good # 4 Thor Male Asgardian Marvel Comics good # 5 Nova Male Human Marvel Comics good # 6 Iron Man Male Human Marvel Comics good # 7 Watcher Male <NA> Marvel Comics good # 8 War Machine Male Human Marvel Comics good # 9 Superboy Male <NA> DC Comics good # 10 Black Bolt Male Inhuman Marvel Comics good # 11 Silver Surfer Male Alien Marvel Comics good # 12 Beyonder Male God / Eternal Marvel Comics good # 13 Vision Male Android Marvel Comics good # 14 X-Man Male <NA> Marvel Comics good # 15 Warlock Male <NA> Marvel Comics good # 16 Hulk Male Human / Radiation Marvel Comics good # 17 Hercules Male Demi-God Marvel Comics good # 18 Century Male Alien Marvel Comics good # 19 Hyperion Male Eternal Marvel Comics good # 20 Beta Ray Bill Male <NA> Marvel Comics good # 21 Sentry Male Mutant Marvel Comics good # 22 Kilowog Male Bolovaxian DC Comics good # 23 Wonder Man Male <NA> Marvel Comics good # 24 Ares Male <NA> Marvel Comics good # 25 Steel Male <NA> DC Comics good # 26 Toxin Male Symbiote Marvel Comics good # 27 Hal Jordan Male Human DC Comics good # 28 Nova Male Human Marvel Comics good # 29 Osiris Male <NA> DC Comics good # 30 Spider-Man Male Human Marvel Comics good # 31 Groot Male Flora Colossus Marvel Comics good # 32 Aquaman Male Atlantean DC Comics good # 33 Red Hulk Male Human / Radiation Marvel Comics good # 34 Iceman Male Mutant Marvel Comics good # 35 Abin Sur Male Ungaran DC Comics good # 36 Colossus Male Mutant Marvel Comics good # 37 Thunderstrike Male <NA> Marvel Comics good # 38 Dr Manhattan Male Human / Cosmic DC Comics good # 39 Skaar Male <NA> Marvel Comics good # 40 Cable Male Mutant Marvel Comics good # 41 Plastic Man Male Human DC Comics good # 42 Fin Fang Foom Male Kakarantharaian Marvel Comics good # 43 Krypto Male Kryptonian DC Comics good # 44 Cyborg Male Cyborg DC Comics good # 45 Animal Man Male Human DC Comics good # 46 Ymir Male Frost Giant Marvel Comics good # 47 Agent Zero Male <NA> Marvel Comics good # 48 Alan Scott Male <NA> DC Comics good # 49 Cannonball Male <NA> Marvel Comics good # 50 Thing Male Human / Radiation Marvel Comics good # 51 Doc Samson Male Human / Radiation Marvel Comics good # 52 Captain Britain Male Human Marvel Comics good # 53 Red Tornado Male Android DC Comics good # 54 Guy Gardner Male Human-Vuldarian DC Comics good # 55 Wolverine Male Mutant Marvel Comics good # 56 John Stewart Male Human DC Comics good # 57 Doctor Strange Male Human Marvel Comics good # 58 Quicksilver Male Mutant Marvel Comics good # 59 Atlas Male Mutant Marvel Comics good # 60 Captain Marvel II Male Human DC Comics good # 61 Ghost Rider Male Demon Marvel Comics good # 62 Aqualad Male Atlantean DC Comics good # 63 Firestorm Male <NA> DC Comics good # 64 Scarlet Spider Male Human Marvel Comics good # 65 Booster Gold Male Human DC Comics good # 66 Mimic Male <NA> Marvel Comics good # 67 Doctor Fate Male Human DC Comics good # 68 Offspring Male <NA> DC Comics good # 69 Blue Beetle III Male Human DC Comics good # 70 Flash III Male Human DC Comics good # 71 Jack of Hearts Male Human Marvel Comics good # 72 Northstar Male <NA> Marvel Comics good # 73 Beast Male Mutant Marvel Comics good # 74 Shatterstar Male <NA> Marvel Comics good # 75 Impulse Male Human DC Comics good # 76 Warpath Male Mutant Marvel Comics good # 77 Black Panther Male Human Marvel Comics good # 78 Deadman Male Human DC Comics good # 79 Sunspot Male Mutant Marvel Comics good # 80 Battlestar Male <NA> Marvel Comics good # 81 Winter Soldier Male Human Marvel Comics good # 82 Flash II Male Human DC Comics good # 83 Scarlet Spider II Male Clone Marvel Comics good # 84 Man-Thing Male <NA> Marvel Comics good # 85 Bishop Male Mutant Marvel Comics good # 86 Batman Male Human DC Comics good # 87 Wildfire Male <NA> DC Comics good # 88 Darkhawk Male Human Marvel Comics good # 89 Magog Male <NA> DC Comics good # 90 Synch Male <NA> Marvel Comics good # 91 Bloodhawk Male Mutant Marvel Comics good # 92 Captain America Male Human Marvel Comics good # 93 Iron Fist Male Human Marvel Comics good # 94 Beast Boy Male Human DC Comics good # 95 A-Bomb Male Human Marvel Comics good # 96 Luke Cage Male Human Marvel Comics good # 97 Human Torch Male Human / Radiation Marvel Comics good # 98 Cloak Male <NA> Marvel Comics good # 99 Flash IV Male Human DC Comics good # 100 Cyclops Male Mutant Marvel Comics good # 101 Blade Male Vampire Marvel Comics good # 102 Deathlok Male Cyborg Marvel Comics good # 103 Space Ghost Male Human DC Comics good # 104 Metron Male <NA> DC Comics good # 105 Batman II Male Human DC Comics good # 106 Nightwing Male Human DC Comics good # 107 Daredevil Male Human Marvel Comics good # 108 John Wraith Male <NA> Marvel Comics good # 109 Mister Fantastic Male Human / Radiation Marvel Comics good # 110 Man-Wolf Male <NA> Marvel Comics good # 111 Sasquatch Male <NA> Marvel Comics good # 112 Banshee Male Human Marvel Comics good # 113 Black Lightning Male <NA> DC Comics good # 114 Hawk Male <NA> DC Comics good # 115 Chamber Male Mutant Marvel Comics good # 116 Shang-Chi Male Human Marvel Comics good # 117 Nick Fury Male Human Marvel Comics good # 118 Havok Male Mutant Marvel Comics good # 119 Maverick Male <NA> Marvel Comics good # 120 Archangel Male Mutant Marvel Comics good # 121 Green Arrow Male Human DC Comics good # 122 Black Knight III Male Human Marvel Comics good # 123 Gambit Male Mutant Marvel Comics good # 124 Robin III Male Human DC Comics good # 125 Red Robin Male Human DC Comics good # 126 Question Male Human DC Comics good # 127 Gravity Male Human Marvel Comics good # 128 Multiple Man Male <NA> Marvel Comics good # 129 Professor X Male Mutant Marvel Comics good # 130 Moon Knight Male Human Marvel Comics good # 131 Nightcrawler Male <NA> Marvel Comics good # 132 Brainiac 5 Male <NA> DC Comics good # 133 Elongated Man Male <NA> DC Comics good # 134 Justice Male Human Marvel Comics good # 135 Angel Male <NA> Marvel Comics good # 136 Punisher Male Human Marvel Comics good # 137 Ink Male Mutant Marvel Comics good # 138 Longshot Male Human Marvel Comics good # 139 Rorschach Male Human DC Comics good # 140 Azrael Male Human DC Comics good # 141 Bantam Male <NA> Marvel Comics good # 142 Sobek Male <NA> DC Comics good # 143 Red Arrow Male Human DC Comics good # 144 Thunderbird Male <NA> Marvel Comics good # 145 Ant-Man Male Human Marvel Comics good # 146 Robin V Male Human DC Comics good # 147 Falcon Male Human Marvel Comics good # 148 Spyke Male Mutant Marvel Comics good # 149 Kid Flash Male Human DC Comics good # 150 Hawkeye Male Human Marvel Comics good # 151 Lightning Lad Male <NA> DC Comics good # 152 Rocket Raccoon Male Animal Marvel Comics good # 153 Micro Lad Male <NA> DC Comics good # 154 Ant-Man II Male Human Marvel Comics good # 155 Ben 10 Male <NA> DC Comics good # 156 Yellowjacket Male Human Marvel Comics good # 157 Bushido Male Human DC Comics good # 158 Leech Male <NA> Marvel Comics good # 159 Quill Male <NA> Marvel Comics good # 160 Aquababy Male <NA> DC Comics good # 161 Agent Bob Male Human Marvel Comics good # 162 Captain Atom Male Human / Radiation DC Comics good # 163 Franklin Richards Male Mutant Marvel Comics good # 164 Namor Male <NA> Marvel Comics good # 165 Robin II Male Human DC Comics good # 166 Spectre Male God / Eternal DC Comics good # 167 Garbage Man Male Mutant DC Comics good # 168 Hellstorm Male <NA> Marvel Comics good # 169 Adam Strange Male Human DC Comics good # 170 Green Goblin III Male <NA> Marvel Comics good # 171 Green Goblin IV Male <NA> Marvel Comics good # 172 Speedy Male Human DC Comics good # 173 Speedball Male <NA> Marvel Comics good # 174 Thunderbird III Male <NA> Marvel Comics good # 175 Atom II Male Human DC Comics good # 176 Aztar Male <NA> DC Comics good # 177 Beak Male <NA> Marvel Comics good # 178 Blue Beetle Male <NA> DC Comics good # 179 Bumbleboy Male <NA> Marvel Comics good # 180 Captain Planet Male God / Eternal Marvel Comics good # 181 Crimson Crusader Male <NA> Marvel Comics good # 182 Monarch Male <NA> DC Comics good # 183 Phantom Male <NA> DC Comics good # 184 Atom Male <NA> DC Comics good # 185 Atom IV Male <NA> DC Comics good # 186 Blue Beetle II Male <NA> DC Comics good # 187 Goliath IV Male <NA> Marvel Comics good # 188 Penance II Male <NA> Marvel Comics good # 189 Atom III Male <NA> DC Comics good # 190 Hawkman Male <NA> DC Comics good # 191 Brother Voodoo Male Human Marvel Comics good # 192 Metamorpho Male <NA> DC Comics good # 193 Genesis Male <NA> Marvel Comics good # Intelligence Strength Speed Durability Power Combat Total # 1 100 100 96 100 100 85 581 # 2 100 100 100 100 94 85 579 # 3 88 85 100 110 100 85 568 # 4 69 100 92 100 100 85 546 # 5 100 85 67 101 100 85 538 # 6 100 85 58 85 100 64 492 # 7 100 80 67 89 100 56 492 # 8 63 80 63 100 100 85 491 # 9 75 95 83 90 84 60 487 # 10 75 67 100 84 100 56 482 # 11 63 100 84 101 100 32 480 # 12 88 100 23 100 100 56 467 # 13 100 72 54 95 76 70 467 # 14 88 53 53 95 92 84 465 # 15 88 36 79 95 71 95 464 # 16 88 100 47 100 41 85 461 # 17 63 100 46 85 67 100 461 # 18 88 80 53 64 74 100 459 # 19 63 95 75 95 58 72 458 # 20 63 80 35 95 100 84 457 # 21 75 80 58 84 97 54 448 # 22 81 90 53 42 100 80 446 # 23 75 100 53 90 64 64 446 # 24 75 82 35 80 62 101 435 # 25 81 82 53 90 64 64 434 # 26 56 73 70 84 75 70 428 # 27 63 90 53 64 100 56 426 # 28 38 60 100 100 100 25 423 # 29 75 85 60 95 65 42 422 # 30 88 55 60 74 58 85 420 # 31 75 85 33 70 92 64 419 # 32 63 80 50 80 65 80 418 # 33 50 88 47 95 59 75 414 # 34 63 32 53 100 100 64 412 # 35 50 90 53 64 84 65 406 # 36 63 83 33 100 46 80 405 # 37 63 80 70 84 31 72 400 # 38 88 32 42 95 100 42 399 # 39 50 85 27 90 62 85 399 # 40 88 48 23 56 100 80 395 # 41 50 63 23 100 100 56 392 # 42 50 81 23 100 68 70 392 # 43 9 80 100 90 72 40 391 # 44 75 53 42 85 72 64 391 # 45 56 48 47 85 73 80 389 # 46 50 100 27 100 83 28 388 # 47 75 28 38 80 72 95 388 # 48 63 80 23 90 98 32 386 # 49 50 28 67 99 79 56 379 # 50 75 84 21 90 26 80 376 # 51 75 80 33 80 36 70 374 # 52 75 77 50 60 31 80 373 # 53 75 38 67 60 92 40 372 # 54 38 80 27 64 97 64 370 # 55 55 32 38 100 44 100 369 # 56 50 80 27 64 94 54 369 # 57 100 10 12 84 100 60 366 # 58 63 28 100 60 57 56 364 # 59 50 80 23 99 69 42 363 # 60 75 81 27 90 34 56 363 # 61 50 55 25 100 70 60 360 # 62 63 44 42 75 76 60 360 # 63 50 53 58 56 100 42 359 # 64 75 53 60 74 39 56 357 # 65 56 85 53 50 72 40 356 # 66 63 67 47 56 79 42 354 # 67 81 16 25 80 100 50 352 # 68 50 10 35 99 100 56 350 # 69 50 34 58 80 97 30 349 # 70 63 10 100 60 83 32 348 # 71 63 55 100 30 70 30 348 # 72 50 18 83 56 70 70 347 # 73 88 48 35 56 35 84 346 # 74 63 48 45 64 42 84 346 # 75 50 10 100 60 63 60 343 # 76 38 72 47 70 26 84 337 # 77 88 16 30 60 41 100 335 # 78 50 10 33 100 100 42 335 # 79 63 63 35 25 79 70 335 # 80 50 53 35 74 48 74 334 # 81 56 32 35 65 60 84 332 # 82 63 10 100 60 66 32 331 # 83 88 55 60 40 30 56 329 # 84 50 32 8 100 98 40 328 # 85 63 14 23 75 85 65 325 # 86 100 18 27 42 37 100 324 # 87 50 32 23 100 77 42 324 # 88 50 32 33 70 74 64 323 # 89 50 48 23 64 66 72 323 # 90 75 67 23 28 74 56 323 # 91 50 10 50 80 66 64 320 # 92 63 19 35 56 46 100 319 # 93 75 23 35 42 43 100 318 # 94 50 28 50 70 79 40 317 # 95 38 100 17 80 17 64 316 # 96 44 55 23 95 35 64 316 # 97 56 10 63 70 74 42 315 # 98 63 10 47 64 74 56 314 # 99 63 10 100 32 59 48 312 # 100 75 10 23 42 76 80 306 # 101 63 28 38 50 33 90 302 # 102 69 32 30 70 40 60 301 # 103 38 18 33 40 90 80 299 # 104 88 10 47 56 69 28 298 # 105 88 11 33 28 36 100 296 # 106 88 11 33 28 36 100 296 # 107 75 13 27 28 57 95 295 # 108 75 12 35 28 65 80 295 # 109 100 10 18 70 32 64 294 # 110 63 44 35 42 38 70 292 # 111 75 80 23 56 15 42 291 # 112 50 10 58 42 60 70 290 # 113 50 11 53 28 70 75 287 # 114 38 38 35 95 36 42 284 # 115 50 10 20 80 57 64 281 # 116 63 12 30 50 25 100 280 # 117 75 11 23 42 25 100 276 # 118 63 10 25 60 71 45 274 # 119 63 10 12 42 60 85 272 # 120 63 13 58 64 28 42 268 # 121 75 12 35 28 26 90 266 # 122 63 10 8 70 43 70 264 # 123 63 10 23 28 55 84 263 # 124 81 11 27 28 30 85 262 # 125 81 11 27 32 29 80 260 # 126 81 14 27 35 20 80 257 # 127 50 32 33 40 72 30 257 # 128 63 11 23 70 28 62 257 # 129 100 8 12 14 90 32 256 # 130 50 36 23 42 28 75 254 # 131 50 10 47 14 52 80 253 # 132 100 10 23 28 60 32 253 # 133 38 10 27 90 41 42 248 # 134 50 10 33 70 55 30 248 # 135 63 13 46 64 17 42 245 # 136 50 16 23 28 22 100 239 # 137 38 28 17 40 66 50 239 # 138 50 10 27 10 71 70 238 # 139 75 10 29 20 23 80 237 # 140 63 18 17 20 35 80 233 # 141 25 53 23 54 21 56 232 # 142 50 34 23 46 20 56 229 # 143 63 16 25 20 24 80 228 # 144 50 32 27 32 14 70 225 # 145 100 10 23 28 32 32 225 # 146 69 8 33 16 29 65 220 # 147 38 13 50 28 22 64 215 # 148 50 12 17 60 41 30 210 # 149 25 4 92 42 13 30 206 # 150 50 12 23 14 26 80 205 # 151 38 10 23 28 60 42 201 # 152 50 5 23 28 28 64 198 # 153 38 28 27 28 44 32 197 # 154 63 10 23 28 32 28 184 # 155 10 7 8 10 90 40 165 # 156 88 10 12 28 12 14 164 # 157 38 10 8 10 19 70 155 # 158 25 5 12 14 62 14 132 # 159 38 10 12 14 23 14 111 # 160 10 16 12 14 37 14 103 # 161 10 8 13 5 5 20 61 # 162 1 1 1 1 0 1 5 # 163 1 1 1 1 0 1 5 # 164 1 1 1 1 0 1 5 # 165 1 1 1 1 0 1 5 # 166 1 1 1 1 0 1 5 # 167 1 1 1 1 0 1 5 # 168 1 1 1 1 0 1 5 # 169 1 1 1 1 0 1 5 # 170 1 1 1 1 0 1 5 # 171 1 1 1 1 0 1 5 # 172 1 1 1 1 0 1 5 # 173 1 1 1 1 0 1 5 # 174 1 1 1 1 0 1 5 # 175 1 1 1 1 0 1 5 # 176 1 1 1 1 0 1 5 # 177 1 1 1 1 0 1 5 # 178 1 1 1 1 0 1 5 # 179 1 1 1 1 0 1 5 # 180 1 1 1 1 0 1 5 # 181 1 1 1 1 0 1 5 # 182 1 1 1 1 0 1 5 # 183 1 1 1 1 0 1 5 # 184 1 1 1 1 0 1 5 # 185 1 1 1 1 0 1 5 # 186 1 1 1 1 0 1 5 # 187 1 1 1 1 0 1 5 # 188 1 1 1 1 0 1 5 # 189 1 1 1 1 0 1 5 # 190 1 1 1 1 0 1 5 # 191 1 1 1 1 0 1 5 # 192 1 1 1 1 0 1 5 # 193 1 1 1 1 0 1 5 # Ambos ? marvelDc %>% select(-SuperPower) %>% distinct() %>% # eliminas duplicados filter(Gender == "Male" & Alignment == c("good", "bad")) %>% arrange(-Total) # Name Gender Race Publisher Alignment # 1 Superman Male Kryptonian DC Comics good # 2 Superboy-Prime Male Kryptonian DC Comics bad # 3 Amazo Male Android DC Comics bad # 4 Stardust Male <NA> Marvel Comics good # 5 Dormammu Male <NA> Marvel Comics bad # 6 Doomsday Male Alien DC Comics bad # 7 Nova Male Human Marvel Comics good # 8 Abraxas Male Cosmic Entity Marvel Comics bad # 9 Black Adam Male <NA> DC Comics bad # 10 Match Male <NA> DC Comics bad # 11 Iron Man Male Human Marvel Comics good # 12 War Machine Male Human Marvel Comics good # 13 Superboy Male <NA> DC Comics good # 14 Silver Surfer Male Alien Marvel Comics good # 15 Vision Male Android Marvel Comics good # 16 Warlock Male <NA> Marvel Comics good # 17 Destroyer Male <NA> Marvel Comics bad # 18 Air-Walker Male <NA> Marvel Comics bad # 19 Century Male Alien Marvel Comics good # 20 Hyperion Male Eternal Marvel Comics good # 21 Beta Ray Bill Male <NA> Marvel Comics good # 22 Carnage Male Symbiote Marvel Comics bad # 23 Magneto Male Mutant Marvel Comics bad # 24 Sentry Male Mutant Marvel Comics good # 25 Kilowog Male Bolovaxian DC Comics good # 26 Abomination Male Human / Radiation Marvel Comics bad # 27 Steel Male <NA> DC Comics good # 28 Doctor Doom Male Human Marvel Comics bad # 29 Sinestro Male Korugaran DC Comics bad # 30 Toxin Male Symbiote Marvel Comics good # 31 Hal Jordan Male Human DC Comics good # 32 Osiris Male <NA> DC Comics good # 33 Groot Male Flora Colossus Marvel Comics good # 34 Kang Male <NA> Marvel Comics bad # 35 Red Hulk Male Human / Radiation Marvel Comics good # 36 Swamp Thing Male God / Eternal DC Comics bad # 37 Abin Sur Male Ungaran DC Comics good # 38 Colossus Male Mutant Marvel Comics good # 39 Thunderstrike Male <NA> Marvel Comics good # 40 Skaar Male <NA> Marvel Comics good # 41 Plastic Man Male Human DC Comics good # 42 Fin Fang Foom Male Kakarantharaian Marvel Comics good # 43 Animal Man Male Human DC Comics good # 44 Agent Zero Male <NA> Marvel Comics good # 45 Alan Scott Male <NA> DC Comics good # 46 Iron Monger Male <NA> Marvel Comics bad # 47 Thing Male Human / Radiation Marvel Comics good # 48 Doc Samson Male Human / Radiation Marvel Comics good # 49 Utgard-Loki Male Frost Giant Marvel Comics bad # 50 Mach-IV Male <NA> Marvel Comics bad # 51 Azazel Male Neyaphem Marvel Comics bad # 52 Exodus Male Mutant Marvel Comics bad # 53 Quicksilver Male Mutant Marvel Comics good # 54 Captain Marvel II Male Human DC Comics good # 55 Ghost Rider Male Demon Marvel Comics good # 56 Rhino Male Human / Radiation Marvel Comics bad # 57 Firestorm Male <NA> DC Comics good # 58 Doctor Fate Male Human DC Comics good # 59 Offspring Male <NA> DC Comics good # 60 Flash III Male Human DC Comics good # 61 Jack of Hearts Male Human Marvel Comics good # 62 Impulse Male Human DC Comics good # 63 Molten Man Male <NA> Marvel Comics bad # 64 Black Panther Male Human Marvel Comics good # 65 Deadman Male Human DC Comics good # 66 Battlestar Male <NA> Marvel Comics good # 67 Venom II Male <NA> Marvel Comics bad # 68 Winter Soldier Male Human Marvel Comics good # 69 Flash II Male Human DC Comics good # 70 Ra's Al Ghul Male Human DC Comics bad # 71 Scarlet Spider II Male Clone Marvel Comics good # 72 Bishop Male Mutant Marvel Comics good # 73 Batman Male Human DC Comics good # 74 Wildfire Male <NA> DC Comics good # 75 Magog Male <NA> DC Comics good # 76 Bloodhawk Male Mutant Marvel Comics good # 77 Iron Fist Male Human Marvel Comics good # 78 Beast Boy Male Human DC Comics good # 79 A-Bomb Male Human Marvel Comics good # 80 Electro Male Human Marvel Comics bad # 81 Human Torch Male Human / Radiation Marvel Comics good # 82 Cloak Male <NA> Marvel Comics good # 83 Blob Male <NA> Marvel Comics bad # 84 Cyclops Male Mutant Marvel Comics good # 85 Deathlok Male Cyborg Marvel Comics good # 86 Mister Fantastic Male Human / Radiation Marvel Comics good # 87 Man-Wolf Male <NA> Marvel Comics good # 88 Sasquatch Male <NA> Marvel Comics good # 89 Joker Male Human DC Comics bad # 90 Banshee Male Human Marvel Comics good # 91 Shocker Male Human Marvel Comics bad # 92 Vanisher Male <NA> Marvel Comics bad # 93 Vulture Male Human Marvel Comics bad # 94 Hawk Male <NA> DC Comics good # 95 Lizard Male Human Marvel Comics bad # 96 Green Goblin II Male <NA> Marvel Comics bad # 97 Shang-Chi Male Human Marvel Comics good # 98 Mister Mxyzptlk Male God / Eternal DC Comics bad # 99 Green Goblin Male Human Marvel Comics bad # 100 Tiger Shark Male Human Marvel Comics bad # 101 Green Arrow Male Human DC Comics good # 102 Black Knight III Male Human Marvel Comics good # 103 Gambit Male Mutant Marvel Comics good # 104 Red Robin Male Human DC Comics good # 105 Question Male Human DC Comics good # 106 Gravity Male Human Marvel Comics good # 107 Multiple Man Male <NA> Marvel Comics good # 108 Kraven II Male Human Marvel Comics bad # 109 Mister Freeze Male Human DC Comics bad # 110 Moon Knight Male Human Marvel Comics good # 111 Nightcrawler Male <NA> Marvel Comics good # 112 Bullseye Male Human Marvel Comics bad # 113 Angel Male <NA> Marvel Comics good # 114 Longshot Male Human Marvel Comics good # 115 Deadshot Male Human DC Comics bad # 116 Azrael Male Human DC Comics good # 117 Red Arrow Male Human DC Comics good # 118 Lightning Lord Male <NA> DC Comics bad # 119 Ant-Man Male Human Marvel Comics good # 120 Proto-Goblin Male <NA> Marvel Comics bad # 121 Robin V Male Human DC Comics good # 122 Falcon Male Human Marvel Comics good # 123 Spyke Male Mutant Marvel Comics good # 124 Red Skull Male <NA> Marvel Comics bad # 125 Hawkeye Male Human Marvel Comics good # 126 Lightning Lad Male <NA> DC Comics good # 127 Kevin 11 Male Human DC Comics bad # 128 Rocket Raccoon Male Animal Marvel Comics good # 129 Blackwing Male <NA> Marvel Comics bad # 130 Lex Luthor Male Human DC Comics bad # 131 Tinkerer Male <NA> Marvel Comics bad # 132 Walrus Male Human Marvel Comics bad # 133 Ben 10 Male <NA> DC Comics good # 134 Yellowjacket Male Human Marvel Comics good # 135 Bushido Male Human DC Comics good # 136 Pyro Male <NA> Marvel Comics bad # 137 Leech Male <NA> Marvel Comics good # 138 Quill Male <NA> Marvel Comics good # 139 Agent Bob Male Human Marvel Comics good # 140 Captain Atom Male Human / Radiation DC Comics good # 141 Doctor Octopus Male Human Marvel Comics bad # 142 Namor Male <NA> Marvel Comics good # 143 Robin II Male Human DC Comics good # 144 Spectre Male God / Eternal DC Comics good # 145 Weapon XI Male <NA> Marvel Comics bad # 146 Hellstorm Male <NA> Marvel Comics good # 147 Mister Sinister Male Human / Altered Marvel Comics bad # 148 Adam Strange Male Human DC Comics good # 149 Green Goblin III Male <NA> Marvel Comics good # 150 Speedy Male Human DC Comics good # 151 Speedball Male <NA> Marvel Comics good # 152 Atom II Male Human DC Comics good # 153 Bird-Man Male Human Marvel Comics bad # 154 Bumbleboy Male <NA> Marvel Comics good # 155 Crimson Crusader Male <NA> Marvel Comics good # 156 Monarch Male <NA> DC Comics good # 157 Ammo Male Human Marvel Comics bad # 158 Atom Male <NA> DC Comics good # 159 Blue Beetle II Male <NA> DC Comics good # 160 Blizzard Male <NA> Marvel Comics bad # 161 Penance II Male <NA> Marvel Comics good # 162 Atom III Male <NA> DC Comics good # 163 Razor-Fist II Male <NA> Marvel Comics bad # 164 Genesis Male <NA> Marvel Comics good # Intelligence Strength Speed Durability Power Combat Total # 1 100 100 100 100 94 85 579 # 2 94 100 100 100 100 85 579 # 3 75 100 100 100 100 100 575 # 4 88 85 100 110 100 85 568 # 5 88 95 83 100 100 80 546 # 6 88 80 67 120 100 90 545 # 7 100 85 67 101 100 85 538 # 8 88 100 83 99 100 56 526 # 9 88 100 92 100 89 56 525 # 10 75 95 83 85 90 70 498 # 11 100 85 58 85 100 64 492 # 12 63 80 63 100 100 85 491 # 13 75 95 83 90 84 60 487 # 14 63 100 84 101 100 32 480 # 15 100 72 54 95 76 70 467 # 16 88 36 79 95 71 95 464 # 17 50 95 58 98 90 70 461 # 18 50 85 100 85 100 40 460 # 19 88 80 53 64 74 100 459 # 20 63 95 75 95 58 72 458 # 21 63 80 35 95 100 84 457 # 22 63 63 70 84 81 90 451 # 23 88 80 27 84 91 80 450 # 24 75 80 58 84 97 54 448 # 25 81 90 53 42 100 80 446 # 26 63 80 53 90 55 95 436 # 27 81 82 53 90 64 64 434 # 28 100 32 20 100 93 84 429 # 29 75 80 53 64 100 56 428 # 30 56 73 70 84 75 70 428 # 31 63 90 53 64 100 56 426 # 32 75 85 60 95 65 42 422 # 33 75 85 33 70 92 64 419 # 34 100 48 58 70 71 70 417 # 35 50 88 47 95 59 75 414 # 36 88 80 23 100 66 56 413 # 37 50 90 53 64 84 65 406 # 38 63 83 33 100 46 80 405 # 39 63 80 70 84 31 72 400 # 40 50 85 27 90 62 85 399 # 41 50 63 23 100 100 56 392 # 42 50 81 23 100 68 70 392 # 43 56 48 47 85 73 80 389 # 44 75 28 38 80 72 95 388 # 45 63 80 23 90 98 32 386 # 46 88 63 25 90 57 56 379 # 47 75 84 21 90 26 80 376 # 48 75 80 33 80 36 70 374 # 49 50 80 23 84 72 64 373 # 50 75 36 60 84 60 56 371 # 51 50 11 47 95 87 80 370 # 52 63 81 28 28 100 70 370 # 53 63 28 100 60 57 56 364 # 54 75 81 27 90 34 56 363 # 55 50 55 25 100 70 60 360 # 56 25 80 43 90 37 85 360 # 57 50 53 58 56 100 42 359 # 58 81 16 25 80 100 50 352 # 59 50 10 35 99 100 56 350 # 60 63 10 100 60 83 32 348 # 61 63 55 100 30 70 30 348 # 62 50 10 100 60 63 60 343 # 63 50 73 23 84 53 56 339 # 64 88 16 30 60 41 100 335 # 65 50 10 33 100 100 42 335 # 66 50 53 35 74 48 74 334 # 67 50 57 47 70 54 56 334 # 68 56 32 35 65 60 84 332 # 69 63 10 100 60 66 32 331 # 70 100 28 32 42 27 100 329 # 71 88 55 60 40 30 56 329 # 72 63 14 23 75 85 65 325 # 73 100 18 27 42 37 100 324 # 74 50 32 23 100 77 42 324 # 75 50 48 23 64 66 72 323 # 76 50 10 50 80 66 64 320 # 77 75 23 35 42 43 100 318 # 78 50 28 50 70 79 40 317 # 79 38 100 17 80 17 64 316 # 80 69 10 50 56 67 64 316 # 81 56 10 63 70 74 42 315 # 82 63 10 47 64 74 56 314 # 83 10 83 23 95 26 72 309 # 84 75 10 23 42 76 80 306 # 85 69 32 30 70 40 60 301 # 86 100 10 18 70 32 64 294 # 87 63 44 35 42 38 70 292 # 88 75 80 23 56 15 42 291 # 89 100 10 12 56 22 90 290 # 90 50 10 58 42 60 70 290 # 91 63 10 23 70 63 56 285 # 92 63 10 75 56 39 42 285 # 93 63 22 47 56 40 56 284 # 94 38 38 35 95 36 42 284 # 95 38 51 27 70 40 56 282 # 96 75 55 37 50 38 26 281 # 97 63 12 30 50 25 100 280 # 98 113 10 12 14 100 28 277 # 99 75 48 35 48 38 28 272 # 100 38 72 42 70 21 28 271 # 101 75 12 35 28 26 90 266 # 102 63 10 8 70 43 70 264 # 103 63 10 23 28 55 84 263 # 104 81 11 27 32 29 80 260 # 105 81 14 27 35 20 80 257 # 106 50 32 33 40 72 30 257 # 107 63 11 23 70 28 62 257 # 108 50 34 23 28 36 85 256 # 109 75 32 12 70 37 28 254 # 110 50 36 23 42 28 75 254 # 111 50 10 47 14 52 80 253 # 112 50 11 25 70 20 70 246 # 113 63 13 46 64 17 42 245 # 114 50 10 27 10 71 70 238 # 115 50 10 23 28 47 80 238 # 116 63 18 17 20 35 80 233 # 117 63 16 25 20 24 80 228 # 118 44 10 23 42 66 42 227 # 119 100 10 23 28 32 32 225 # 120 63 38 23 48 22 28 222 # 121 69 8 33 16 29 65 220 # 122 38 13 50 28 22 64 215 # 123 50 12 17 60 41 30 210 # 124 75 10 12 14 19 80 210 # 125 50 12 23 14 26 80 205 # 126 38 10 23 28 60 42 201 # 127 25 7 12 14 100 40 198 # 128 50 5 23 28 28 64 198 # 129 38 10 35 32 20 56 191 # 130 100 10 12 14 10 28 174 # 131 100 10 23 14 10 14 171 # 132 50 28 8 50 11 20 167 # 133 10 7 8 10 90 40 165 # 134 88 10 12 28 12 14 164 # 135 38 10 8 10 19 70 155 # 136 38 10 12 14 50 28 152 # 137 25 5 12 14 62 14 132 # 138 38 10 12 14 23 14 111 # 139 10 8 13 5 5 20 61 # 140 1 1 1 1 0 1 5 # 141 1 1 1 1 0 1 5 # 142 1 1 1 1 0 1 5 # 143 1 1 1 1 0 1 5 # 144 1 1 1 1 0 1 5 # 145 1 1 1 1 0 1 5 # 146 1 1 1 1 0 1 5 # 147 1 1 1 1 0 1 5 # 148 1 1 1 1 0 1 5 # 149 1 1 1 1 0 1 5 # 150 1 1 1 1 0 1 5 # 151 1 1 1 1 0 1 5 # 152 1 1 1 1 0 1 5 # 153 1 1 1 1 0 1 5 # 154 1 1 1 1 0 1 5 # 155 1 1 1 1 0 1 5 # 156 1 1 1 1 0 1 5 # 157 1 1 1 1 0 1 5 # 158 1 1 1 1 0 1 5 # 159 1 1 1 1 0 1 5 # 160 1 1 1 1 0 1 5 # 161 1 1 1 1 0 1 5 # 162 1 1 1 1 0 1 5 # 163 1 1 1 1 0 1 5 # 164 1 1 1 1 0 1 5 ``` ] --- ## Deben practicar mucho cuando aprenden un lenguaje ### Cursos - Cursos de [Software Carpentry](https://software-carpentry.org/lessons/) .center[ <img src = "figures/Cursos_softwareCarpentry.png", height = "400"> ] --- ## Referencias - [Tidyverse: dplyr y tidyr](http://gauss.inf.um.es:8080/tabular-tidyverse/) - [Mutating joins](https://dplyr.tidyverse.org/reference/mutate-joins.html) --- class: center, middle
# Viernes 22 de octubre 2023 ## GeneraciĆ³n de diversos grĆ”ficos usando ggplot2 ### Instructora: Sofia Salazar Gracias por tu atenciĆ³n, respira y comĆ©ntame tus dudas.