Skip to content

Instantly share code, notes, and snippets.

@romainfrancois
Created July 6, 2017 06:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save romainfrancois/75b717e83f07c6a5840a392401fe799f to your computer and use it in GitHub Desktop.
Save romainfrancois/75b717e83f07c6a5840a392401fe799f to your computer and use it in GitHub Desktop.
useR2017 attendees
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() )
@romainfrancois
Copy link
Author

> data %>% summarise( profile = sum(!is.na(img)) / n() )
# A tibble: 1 x 1
    profile
      <dbl>
1 0.4186779

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment