-
Notifications
You must be signed in to change notification settings - Fork 0
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
Labels
enhancement
New feature or request
Comments
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 |
Closed
Merged
This was referenced Jan 14, 2023
Closed
Should create a function that consolidates the other function's data. |
This was referenced Jan 14, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Create new function that gathers data on Taylor Swift and Kanye West through tidywikidatar or QueryWikidataServiceR
Data options
The text was updated successfully, but these errors were encountered: