Get lists of Russian or Chinese Diplomats

get_accounts(country, group = c("diplomats"))

Arguments

country

currently supports "RU" and "CN" (or both: c("RU","CN"))

group

currently supports "diplomats"

Value

returns data.frame with twitter handles and details on dipomats

Note

tbc

References

tbc

Examples

options(tidyverse.quiet = TRUE)
library(tidyverse)
#> Warning: replacing previous import 'lifecycle::last_warnings' by 'rlang::last_warnings' when loading 'hms'
ru_accs <- 
  get_accounts(country = "RU",group = "diplomats")
#> Warning: Missing column names filled in: 'X10' [10], 'X11' [11], 'X12' [12], 'X13' [13]
#> 
#> -- Column specification --------------------------------------------------------
#> cols(
#>   country = col_character(),
#>   ISO2 = col_character(),
#>   cat = col_character(),
#>   twitter_handle = col_character(),
#>   remarks = col_character(),
#>   user_id = col_logical(),
#>   started_post = col_character(),
#>   ended_post = col_character(),
#>   last_checked = col_logical(),
#>   X10 = col_logical(),
#>   X11 = col_character(),
#>   X12 = col_character(),
#>   X13 = col_character()
#> )
#> 
#> -- Column specification --------------------------------------------------------
#> cols(
#>   handle = col_character(),
#>   url_handle = col_character(),
#>   gov_label = col_character(),
#>   name = col_character(),
#>   description = col_character(),
#>   followers = col_character(),
#>   verified = col_logical(),
#>   date_scraped = col_date(format = ""),
#>   filename = col_character(),
#>   followers_num = col_double()
#> )
#> 
#> -- Column specification --------------------------------------------------------
#> cols(
#>   .default = col_character(),
#>   user_id = col_double(),
#>   protected = col_logical(),
#>   followers_count = col_double(),
#>   friends_count = col_double(),
#>   listed_count = col_double(),
#>   statuses_count = col_double(),
#>   favourites_count = col_double(),
#>   account_created_at = col_datetime(format = ""),
#>   verified = col_logical(),
#>   account_lang = col_logical(),
#>   date_scraped = col_date(format = "")
#> )
#> i Use `spec()` for the full column specifications.
#> [1] "321 Russian diplomats and government accounts. Twitter transparency labels as of 2022-04-26. Account data as of 2022-04-26."

head(ru_accs,10)
#> # A tibble: 10 x 27
#>    country     ISO2  cat   twitter_handle  gov_label user_id screen_name name   
#>    <chr>       <chr> <chr> <chr>           <chr>       <dbl> <chr>       <chr>  
#>  1 Afghanistan AF    E     RusEmbassyKabul Russia g~ 3.41e 8 RusEmbassy~ "Russi~
#>  2 Afghanistan AF    C     ruscg_mzs       NA        7.95e17 RusCG_MZS   "Russi~
#>  3 Albania     AL    E     RussianAlbania  Russia g~ 1.37e18 RussianAlb~ "Russi~
#>  4 Algeria     DZ    E     AmbRus_Algerie  NA        3.43e 8 AmbRus_Alg~ "Ambas~
#>  5 Angola      AO    E     russembangola4  Rússia o~ 1.43e18 russembang~ "russe~
#>  6 Argentina   AR    E     EmbRusiaEnArgEs NA        3.40e 8 EmbRusiaEn~ "Embaj~
#>  7 Argentina   AR    E     EmbRusiaEnArgRu NA        2.84e 9 EmbRusiaEn~ "<U+041F><U+043E><U+0441><U+043E><U+043B>~
#>  8 Armenia     AM    E     rusembassyARM   NA        1.65e 9 rusembassy~ "<U+041F><U+043E><U+0441><U+043E><U+043B>~
#>  9 Armena      AM    C     GyumriRussia    NA        1.02e18 GyumriRuss~ "<U+0413><U+0435><U+043D><U+0435><U+0440>~
#> 10 Australia   AU    E     RusEmbAU        Russia g~ 2.39e 9 RusEmbAU    "Russi~
#> # ... with 19 more variables: location <chr>, description <chr>, url <chr>,
#> #   protected <lgl>, followers_count <dbl>, friends_count <dbl>,
#> #   listed_count <dbl>, statuses_count <dbl>, favourites_count <dbl>,
#> #   account_created_at <dttm>, verified <lgl>, profile_url <chr>,
#> #   profile_expanded_url <chr>, account_lang <lgl>, profile_banner_url <chr>,
#> #   profile_background_url <chr>, profile_image_url <chr>, data_scraped <date>,
#> #   labels_scraped <date>

ru_accs %>%
  group_by(cat) %>%
  mutate(n_cat = n()) %>%
  group_by(cat,n_cat,gov_label = gov_label != "") %>%
  summarise(n = n()) %>%
  mutate(perc = n/n_cat) %>% filter(gov_label == T)
#> `summarise()` has grouped output by 'cat', 'n_cat'. You can override using the `.groups` argument.
#> # A tibble: 6 x 5
#> # Groups:   cat, n_cat [6]
#>   cat   n_cat gov_label     n   perc
#>   <chr> <int> <lgl>     <int>  <dbl>
#> 1 A         7 TRUE          1 0.143 
#> 2 C        66 TRUE          5 0.0758
#> 3 E       161 TRUE         88 0.547 
#> 4 G        55 TRUE         14 0.255 
#> 5 QG       11 TRUE          1 0.0909
#> 6 S         8 TRUE          3 0.375