Created
July 6, 2017 06:00
-
-
Save romainfrancois/75b717e83f07c6a5840a392401fe799f to your computer and use it in GitHub Desktop.
useR2017 attendees
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(rvest) | |
library(purrr) | |
library(tibble) | |
library(dplyr) | |
library(stringr) | |
attendees <- function(page) { | |
extract <- function(class) html_node( persons, class ) %>% html_text() %>% str_trim() | |
url <- paste0( 'https://user2017.sched.com/directory/attendees/', page ) | |
persons <- read_html(url) %>% | |
html_nodes(".sched-person") | |
tibble( | |
position = extract(".sched-event-details-position"), | |
company = extract(".sched-event-details-company"), | |
id = extract("h2:nth-child(2) a"), | |
img = html_node(persons, "img") %>% html_attr("src") | |
) | |
} | |
data <- map_df( 1:6, attendees ) | |
data %>% | |
summarise( profile = sum(!is.na(img)) / n() ) |
Author
romainfrancois
commented
Jul 6, 2017
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment