

Therefore, we first scrape an HTML table of country names, ISO3, ISO2 and UN codes for all countries worldwide. As different data sets have different formats for country names (e.g., “United Kingdom of Great Britain and Northern Ireland” versus “United Kingdom”), we’ll match country names to ISO3 codes to easily merge all data sets later on. As we’ll make world maps, we need a way to map our data sets to geographical data containing coordinates (longitude and latitude). Now, we can continue with loading our data. Importing, exploring and cleaning the data Let’s first load the required packages into RStudio.

We’ll start by loading and cleaning the data, whereafter we will build our interactive world maps in R Shiny. The data sources here are about childlessness and gender inequality, which is the focus of my PhD research, in which I computationally analyse the effects of gender and parental status on socio-economic inequalities. To show you how to adapt the interface of the app to the choices of the users, we’ll make use of two data sources such that the user can choose what data they want to explore, and that the app adapts the possible input choices to the users’ previous choices.

As the Shiny app cannot be embedded into this blog, I will direct you to the live app and show you in this post on my GitHub how to embed a Shiny app in your R Markdown files, which is a really cool and innovative way of preparing interactive documents. In this post, I will show you how to create interactive world maps and how to show these in the form of an R Shiny app.

She applies her interdisciplinary knowledge to computationally address societal problems of inequality. With a passion for data science and a background in mathematics and econometrics. Other useful resources: Zev Ross created an easy-to-follow Shiny tutorial with examples and a cheat sheet, and Hadley Wickham has a Mastering Shiny book in progress that’s available free online.Florianne Verkroost is a PhD candidate at Nuffield College at the University of Oxford. To learn more about Shiny, RStudio has some written and video tutorials at. You could keep other columns from the initial data set to filter for variables such as language and geography. Or, you could add a check box to filter for tweets that contain URLs - potentially helpful if you’re looking for conference tweets that might include links to presentations and other resources. You might add sliders to set a minimum number of retweets or likes, and then do additional table filtering on that subset of tweets. There is so much more you could do to add capabilities to this app. # Configure variables: number of tweets to download and hashtag search query num_tweets_to_download % select(user_id, status_id, created_at, screen_name, text, favorite_count, retweet_count, urls_expanded_url) %>% mutate( Tweet = glue::glue(") More enhancements
