class: title-slide, center, middle, inverse background-image: url(https://github.com/guadag12/socialnetwork-rladies-talk/raw/main/img/presentation.jpg) background-position: contain --- class: middle, center .center[ # Agradecimientos! <img src="https://i.pinimg.com/originals/40/1d/89/401d898cafb6e901006ed883650cfecb.gif" width="5%" />] <img src="https://pbs.twimg.com/profile_images/1173008374469996546/UWoNKw-8_400x400.jpg" width="25%" /> [
@RLadiesBA](https://twitter.com/RLadiesBA) [
@rladies-ba](http://rladies-ba.slack.com) --- class: inverse, middle, center ## GUADA GONZALEZ <img src="https://github.com/guadag12/talk-cienciassoccomputacionales/raw/main/img/img-guada.png" width="15%" /> ### Politóloga & Data Scientist #### Coordinadora [GICP Observatorio de Redes](https://twitter.com/O_de_R) #### Investigadora [ILCSS](https://twitter.com/ilcss_umd) #### Profesora [Laboratorio de Políticas Públicas](https://twitter.com/LABPoliticasUBA) --- ### Materiales para hoy * Slides ([link](https://guadag12.github.io/socialnetwork-rladies-talk/)) * Materiales ([link](https://github.com/guadag12/socialnetwork-rladies-talk/tree/main/codigo)) * Slides repositorio ([link](https://github.com/guadag12/socialnetwork-rladies-talk)) * Proyecto Rstudio Cloud ([link](https://rstudio.cloud/project/2794017)) --- ### ¿Qué vamos a ver hoy? * politicxsentwitteR como una fuente de información </br> * ¿Qué es y que no es social network? </br> * Paquetes para hoy: [politicxsentwitteR](https://github.com/guadag12/politicxsentwitteR) e [igraph](https://cran.r-project.org/web/packages/igraph/igraph.pdf) </br> * Nodos y Aristas </br> * Grados de centralidad </br> * Comunidades </br> * Layouts </br> * Redes Interactivas con VisNetwork </br> --- class: middle, center ### politicxsentwitteR 🐦📦 <img src="https://github.com/guadag12/politicxsentwitteR/raw/main/man/figures/logo.png" width="25%" /> #### [Repositorio](https://github.com/guadag12/politicxsentwitteR) #### [Web con ejemplos en español](https://guadag12.github.io/politicxsentwitteR/index.html) --- class: inverse, middle, center ## ¿Pero dónde nace esto? --- class: middle, center ### App politicos en twitter <img src="https://github.com/Observatorio-de-Redes/politicosentwitter/raw/main/ShinyApp/www/shiny%20contest/img%20def.png" width="60%" /> ##### [www.politicosentwitter.com](www.politicosentwitter.com) --- class: inverse, middle, center ## Algunas funciones del paquete para hoy --- ### Obtener data de tweets 🤳 👇 ```r library(politicxsentwitteR) af <- get_timeline_data(screen.name = "alferdez") ``` ```r paged_table(head(af,3)) ``` <div data-pagedtable="false"> <script data-pagedtable-source type="application/json"> {"columns":[{"label":[""],"name":["_rn_"],"type":[""],"align":["left"]},{"label":["user_id"],"name":[1],"type":["chr"],"align":["left"]},{"label":["status_id"],"name":[2],"type":["chr"],"align":["left"]},{"label":["created_at"],"name":[3],"type":["chr"],"align":["left"]},{"label":["screen_name"],"name":[4],"type":["chr"],"align":["left"]},{"label":["text"],"name":[5],"type":["chr"],"align":["left"]},{"label":["source"],"name":[6],"type":["chr"],"align":["left"]},{"label":["is_quote"],"name":[7],"type":["chr"],"align":["left"]},{"label":["is_retweet"],"name":[8],"type":["chr"],"align":["left"]},{"label":["favorite_count"],"name":[9],"type":["chr"],"align":["left"]},{"label":["retweet_count"],"name":[10],"type":["chr"],"align":["left"]},{"label":["lang"],"name":[11],"type":["chr"],"align":["left"]},{"label":["status_url"],"name":[12],"type":["chr"],"align":["left"]},{"label":["name"],"name":[13],"type":["chr"],"align":["left"]},{"label":["mentions_user_id"],"name":[14],"type":["chr"],"align":["left"]},{"label":["mentions_screen_name"],"name":[15],"type":["chr"],"align":["left"]},{"label":["retweet_status_id"],"name":[16],"type":["chr"],"align":["left"]},{"label":["retweet_text"],"name":[17],"type":["chr"],"align":["left"]},{"label":["retweet_created_at"],"name":[18],"type":["chr"],"align":["left"]},{"label":["retweet_source"],"name":[19],"type":["chr"],"align":["left"]},{"label":["retweet_favorite_count"],"name":[20],"type":["chr"],"align":["left"]},{"label":["retweet_retweet_count"],"name":[21],"type":["chr"],"align":["left"]},{"label":["retweet_user_id"],"name":[22],"type":["chr"],"align":["left"]},{"label":["retweet_screen_name"],"name":[23],"type":["chr"],"align":["left"]},{"label":["retweet_name"],"name":[24],"type":["chr"],"align":["left"]},{"label":["retweet_followers_count"],"name":[25],"type":["chr"],"align":["left"]},{"label":["retweet_friends_count"],"name":[26],"type":["chr"],"align":["left"]},{"label":["retweet_statuses_count"],"name":[27],"type":["chr"],"align":["left"]},{"label":["retweet_location"],"name":[28],"type":["chr"],"align":["left"]},{"label":["retweet_description"],"name":[29],"type":["chr"],"align":["left"]},{"label":["retweet_verified"],"name":[30],"type":["chr"],"align":["left"]},{"label":["reply_to_status_id"],"name":[31],"type":["chr"],"align":["left"]},{"label":["reply_to_user_id"],"name":[32],"type":["chr"],"align":["left"]},{"label":["reply_to_screen_name"],"name":[33],"type":["chr"],"align":["left"]},{"label":["urls_url"],"name":[34],"type":["chr"],"align":["left"]},{"label":["urls_t_co"],"name":[35],"type":["chr"],"align":["left"]}],"data":[{"1":"149991703","2":"1132680469269635077","3":"2019-05-26 16:10:42","4":"alferdez","5":"Desatemos la esperanza. Vamos a volver para ser mejores. #EntreTodos https://t.co/Uoed2WF2jX","6":"Twitter for iPhone","7":"FALSE","8":"TRUE","9":"0","10":"3329","11":"es","12":"https://twitter.com/alferdez/status/1132680469269635077","13":"Alberto Fernández","14":"149991703","15":"alferdez","16":"1132416435626676224","17":"Desatemos la esperanza. Vamos a volver para ser mejores. #EntreTodos https://t.co/Uoed2WF2jX","18":"2019-05-25 22:41:32","19":"Twitter for iPhone","20":"14356","21":"3329","22":"149991703","23":"alferdez","24":"Alberto Fernández","25":"1982667","26":"7226","27":"27560","28":"Buenos Aires","29":"Abogado. Profesor de Derecho Penal (UBA). Hincha de Argentinos Juniors. Presidente de la Nación Argentina.","30":"TRUE","31":"NA","32":"NA","33":"NA","34":"NA","35":"NA","_rn_":"1"},{"1":"149991703","2":"1132680508675117056","3":"2019-05-26 16:10:52","4":"alferdez","5":"Para salir del laberinto al que vamos a entrar el diez de diciembre debemos trabajar todos, codo a codo, nadie sobra, todos hacen falta. https://t.co/Ddjx1gZJPw","6":"Twitter for iPhone","7":"FALSE","8":"TRUE","9":"0","10":"4091","11":"es","12":"https://twitter.com/alferdez/status/1132680508675117056","13":"Alberto Fernández","14":"149991703","15":"alferdez","16":"1132635401842253826","17":"Para salir del laberinto al que vamos a entrar el diez de diciembre debemos trabajar todos, codo a codo, nadie sobra, todos hacen falta. https://t.co/Ddjx1gZJPw","18":"2019-05-26 13:11:37","19":"Twitter for iPhone","20":"13800","21":"4091","22":"149991703","23":"alferdez","24":"Alberto Fernández","25":"1982667","26":"7226","27":"27560","28":"Buenos Aires","29":"Abogado. Profesor de Derecho Penal (UBA). Hincha de Argentinos Juniors. Presidente de la Nación Argentina.","30":"TRUE","31":"NA","32":"NA","33":"NA","34":"NA","35":"NA","_rn_":"2"},{"1":"149991703","2":"1137880822546124802","3":"2019-06-10 00:35:03","4":"alferdez","5":"Felicitaciones @bordet por tu merecidisimo triunfo. \\n\\nEl pueblo de Entre Ríos renovó su esperanza. Vamos Argentina.","6":"Twitter Web Client","7":"FALSE","8":"FALSE","9":"5996","10":"1371","11":"es","12":"https://twitter.com/alferdez/status/1137880822546124802","13":"Alberto Fernández","14":"134232117","15":"bordet","16":"NA","17":"NA","18":"NA","19":"NA","20":"NA","21":"NA","22":"NA","23":"NA","24":"NA","25":"NA","26":"NA","27":"NA","28":"NA","29":"NA","30":"NA","31":"NA","32":"NA","33":"NA","34":"NA","35":"NA","_rn_":"3"}],"options":{"columns":{"min":{},"max":[10]},"rows":{"min":[10],"max":[10]},"pages":{}}} </script> </div> --- ### Obtener data de cantidad de followers / friends 👥 ```r library(politicxsentwitteR) library(tidyverse) af_mm <- get_friends_followers(screen.name = c("alferdez", "mauriciomacri")) ``` ```r paged_table(head(af_mm %>% arrange(desc(date)),4)) ``` <div data-pagedtable="false"> <script data-pagedtable-source type="application/json"> {"columns":[{"label":[""],"name":["_rn_"],"type":[""],"align":["left"]},{"label":["screen_name"],"name":[1],"type":["chr"],"align":["left"]},{"label":["date"],"name":[2],"type":["chr"],"align":["left"]},{"label":["followers_count"],"name":[3],"type":["chr"],"align":["left"]},{"label":["friends_count"],"name":[4],"type":["chr"],"align":["left"]},{"label":["listed_count"],"name":[5],"type":["chr"],"align":["left"]},{"label":["statuses_count"],"name":[6],"type":["chr"],"align":["left"]},{"label":["favourites_count"],"name":[7],"type":["chr"],"align":["left"]}],"data":[{"1":"alferdez","2":"2021-08-24","3":"2116848","4":"7200","5":"2055","6":"29130","7":"8083","_rn_":"1"},{"1":"mauriciomacri","2":"2021-08-24","3":"5116194","4":"635","5":"7366","6":"10319","7":"125","_rn_":"2"},{"1":"alferdez","2":"2021-08-23","3":"2116549","4":"7200","5":"2055","6":"29122","7":"8083","_rn_":"3"},{"1":"mauriciomacri","2":"2021-08-23","3":"5116101","4":"635","5":"7365","6":"10319","7":"125","_rn_":"4"}],"options":{"columns":{"min":{},"max":[10]},"rows":{"min":[10],"max":[10]},"pages":{}}} </script> </div> --- <img src="https://github.com/guadag12/socialnetwork-rladies-talk/raw/main/img/paper-sinclair.png" width="150%" /> --- class: center ### ¿Qué entendemos por social network? .pull-left[ __Is a social structure made up of a set of social actors (such as individuals or organizations) and of a complex set of the dyadicties between these actors (Wasserman and Faust 1994)__ ] .pull-right[ ![](https://kateto.net/wp-content/uploads/2015/04/Facebook-friends-net-GEPHI-Images.png) ] --- class: middle, center </br> </br> </br> ![](https://www.universiteitleiden.nl/binaries/content/gallery/ul2/main-images/social-and-behavioural-sciences/cwts/mettekstklein.png/mettekstklein.png/d880x320) </br> </br> </br> </br> .right[ [https://igraph.org/](https://igraph.org/) ] --- ### Packages </br> ```r #library(devtools) #install_github("guadag12/politicxsentwitteR") library(politicxsentwitteR) library(dplyr) library(igraph) library(visNetwork) ``` --- ## Nodos / Vertices .right-column[ <img src="https://github.com/guadag12/socialnetwork-rladies-talk/raw/main/img/nodos_3.png" width="50%" /> ] .left-column[ </br> </br> <div data-pagedtable="false"> <script data-pagedtable-source type="application/json"> {"columns":[{"label":["nodes[, c(1)]"],"name":[1],"type":["chr"],"align":["left"]}],"data":[{"1":"A"},{"1":"B"},{"1":"C"},{"1":"D"},{"1":"E"},{"1":"F"}],"options":{"columns":{"min":{},"max":[10]},"rows":{"min":[10],"max":[10]},"pages":{}}} </script> </div> ] --- ## Aristas / Edges .right-column[ <img src="https://github.com/guadag12/socialnetwork-rladies-talk/raw/main/img/degree.png" width="50%" /> ] .left-column[ </br> <div data-pagedtable="false"> <script data-pagedtable-source type="application/json"> {"columns":[{"label":["from"],"name":[1],"type":["chr"],"align":["left"]},{"label":["to"],"name":[2],"type":["chr"],"align":["left"]}],"data":[{"1":"A","2":"B"},{"1":"B","2":"C"},{"1":"B","2":"D"},{"1":"C","2":"D"},{"1":"D","2":"F"},{"1":"D","2":"A"},{"1":"E","2":"E"}],"options":{"columns":{"min":{},"max":[10]},"rows":{"min":[10],"max":[10]},"pages":{}}} </script> </div> ] --- ### Particularidades de igraph </br> </br> 1️⃣ ```r eigen_centrality(g)$vertices ``` </br> </br> </br> 2️⃣ ```r is.directed(g) ``` ``` ## [1] TRUE ``` --- class: middle, center ### Direccionalidad .pull-left[ #### Undirected <img src="https://github.com/guadag12/socialnetwork-rladies-talk/raw/main/img/undirected_2.png" width="150%" /> ] .pull-right[ #### Directed <img src="https://github.com/guadag12/socialnetwork-rladies-talk/raw/main/img/aristas_directed.png" width="180%" /> ] --- class: middle, center ![](https://i.pinimg.com/originals/5d/ce/36/5dce367792c040a59ec39a459aed1c92.gif) --- ### Customización I <img src="https://github.com/guadag12/socialnetwork-rladies-talk/raw/main/img/customizacion_1.png" width="110%" /> --- ### Customización II <img src="https://github.com/guadag12/socialnetwork-rladies-talk/raw/main/img/customizacion.png" width="60%" /> --- ## Degree (Grado de centralidad) #### La cantidad de edges / aristas / relaciones que tiene un nodo. .pull-left[ <img src="https://github.com/guadag12/socialnetwork-rladies-talk/raw/main/img/degree.png" width="150%" /> ] .pull-right[ </br> </br> <div data-pagedtable="false"> <script data-pagedtable-source type="application/json"> {"columns":[{"label":[""],"name":["_rn_"],"type":[""],"align":["left"]},{"label":["out"],"name":[1],"type":["dbl"],"align":["right"]},{"label":["in."],"name":[2],"type":["dbl"],"align":["right"]}],"data":[{"1":"1","2":"1","_rn_":"A"},{"1":"2","2":"1","_rn_":"B"},{"1":"1","2":"1","_rn_":"C"},{"1":"2","2":"2","_rn_":"D"},{"1":"1","2":"1","_rn_":"E"},{"1":"0","2":"1","_rn_":"F"}],"options":{"columns":{"min":{},"max":[10]},"rows":{"min":[10],"max":[10]},"pages":{}}} </script> </div> ] --- ### Layouts <img src="https://github.com/guadag12/socialnetwork-rladies-talk/raw/main/img/layouts.png" width="105%" /> --- ### Comunidades </br> .pull-left[ </br> ##### Parte / Porción que está más conectada internamente que externamente ] .pull-right[ ![](https://griffsgraphs.files.wordpress.com/2012/07/facebook-network.png) ] --- class: inverse, center, middle ## Agreguemos interactividad ![](https://github.com/guadag12/talk-cienciassoccomputacionales/raw/main/img/gif_def.gif) --- class: middle, center ### Bibliografía complementaria .pull-left[ * [Pablo Barberá](http://pablobarbera.com/) * [Kateto.net](https://kateto.net/netscix2016.html) * [Interactive Network Visualization](https://www.statworx.com/ch/blog/interactive-network-visualization-with-r/) * [Network Science Book](http://networksciencebook.com/) * [Data Storm](http://datastorm-open.github.io/visNetwork/legend.html) * Sinclair, B. (2016). Network Structure and Social Outcomes: Network Analysis for Social Science. In R. Alvarez (Ed.) Computational Social Science: Discovery and Prediction (Analytical Methods for Social Research, pp. 121-139). Ed: Cambridge University Press. * Luke, D. (2015) A User’s Guide to Network Analysis in R. Ed: Springer. ] .pull-right[ <img src="https://github.com/guadag12/socialnetwork-rladies-talk/raw/main/img/calvo_aruguete.png" width="100%" /> ] --- class: inverse, middle, center # GRACIAS!🥰 🙌 </br> ## ESTEMOS EN CONTACTO! 🙌 👇 [
@guadag12](https://twitter.com/guadag12) [
@guadag12](http://github.com/guadag12) [
guadagonz12@gmail.com](guadagonz12@gmail.com)