Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add function to get data from Wikidata #11

Closed
judith-bourque opened this issue Jan 4, 2023 · 2 comments · Fixed by #13 or #20
Closed

Add function to get data from Wikidata #11

judith-bourque opened this issue Jan 4, 2023 · 2 comments · Fixed by #13 or #20
Assignees
Labels
enhancement New feature or request

Comments

@judith-bourque
Copy link
Owner

judith-bourque commented Jan 4, 2023

Create new function that gathers data on Taylor Swift and Kanye West through tidywikidatar or QueryWikidataServiceR

Data options

  • Number of social media followers
  • Number of awards won
  • Number of nominations
  • Net worth
  • Number of instruments played
@judith-bourque judith-bourque added the enhancement New feature or request label Jan 4, 2023
@judith-bourque judith-bourque self-assigned this Jan 5, 2023
@judith-bourque
Copy link
Owner Author

judith-bourque commented Jan 14, 2023

Example from tidywikidatar

get_bio <- function(id, language = "en") {
  tibble::tibble(
    label = tw_get_label(id = id, language = language),
    description = tw_get_description(id = id, language = language),
    year_of_birth = tw_get_property(id = id, p = "P569") %>%
      dplyr::pull(value) %>%
      head(1) %>%
      lubridate::ymd_hms() %>%
      lubridate::year(),
    year_of_death = tw_get_property(id = id, p = "P570") %>%
      dplyr::pull(value) %>%
      head(1) %>%
      lubridate::ymd_hms() %>%
      lubridate::year()
  )
}

tw_search(search = "Margaret Mead") %>%
  tw_filter_first(p = "P31", q = "Q5") %>%
  get_bio()

#> # A tibble: 1 × 4
#>   label         description             year_of_birth year_of_death
#>   <chr>         <chr>                           <dbl>         <dbl>
#> 1 Margaret Mead American anthropologist          1901          1978

@judith-bourque judith-bourque linked a pull request Jan 14, 2023 that will close this issue
This was referenced Jan 14, 2023
@judith-bourque
Copy link
Owner Author

judith-bourque commented Jan 14, 2023

Should create a function that consolidates the other function's data.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
1 participant