Articles by Rolf Fredheim

Digital Data Collection course

March 20, 2015 | Rolf Fredheim

Another year, another web scraping course. Taught through SSRMC at the University of Cambridge. Below are slides from all three sessions.In the course I tried to achieve the following:- Show how to connect R to resources online- Use loops and functions... [Read more...]

Better handling of JSON data in R?

March 13, 2014 | Rolf Fredheim

What is the best way to read data in JSON format into R? Though really common for almost all modern online applications, JSON is not every R user's best friend. After seeing the slides for my Web Scraping course, in which I somewhat arbitrarily veered between using the packages rjson ... [Read more...]

Web Scraping: working with APIs

March 12, 2014 | Rolf Fredheim

APIs present researchers with a diverse set of data sources through a standardised access mechanism: send a pasted together HTTP request, receive JSON or XML in return. Today we tap into a range of APIs to get comfortable sending queries and processing... [Read more...]

Web Scraping part2: Digging deeper

February 25, 2014 | Rolf Fredheim

Slides from the second web scraping through R session: Web scraping for the humanities and social sciencesIn which we make sure we are comfortable with functions, before looking at XPath queries to download data from newspaper articles. Examples includ... [Read more...]

Web-Scraping: the Basics

February 19, 2014 | Rolf Fredheim

Slides from the first session of my course about web scraping through R: Web scraping for the humanities and social sciencesIncludes an introduction to the paste function, working with URLs, functions and loops. Putting it all together we fetch data in... [Read more...]

Plugging hierarchical data from R into d3

November 20, 2013 | Rolf Fredheim

Here I show how to convert tabulated data into a json format that can be used in d3 graphics. The motivation for this was an attempt at getting an overview of topic models (link). Illustrations like the one to the right are very attractive; my motivati... [Read more...]

Visualising Structure in Topic Models

November 11, 2013 | Rolf Fredheim

How exactly should we visualise topic models to get an overview of how topics relate to each other? This post is a brief lit review of that debate - I realise the subject matter is sooo last year. I also present my chosen solution to the dilemma: I use dendrograms ... [Read more...]

Fun simulating Wimbledon in R and Python

July 4, 2013 | Rolf Fredheim

R and Python have different strengths. There's little you can do in R you absolutely can't do in Python and vice versa, but there's a lot of stuff that's really annoying in one and nice and simple in the other. I'm sure simulations can be run in R, but it ... [Read more...]

big geo-data visualisations

April 17, 2013 | Rolf Fredheim

Spotting international conflict is very easy with the GDELT data set, combined with ggplot and R. The simple gif above shows snapshots of Russian/Soviet activity from January 1980 and January 2000. I think it also illustrates how Russia nowadays looks more to the east and the South than during the Cold ... [Read more...]

Reproducible research with R, Knitr, Pandoc and Word

February 25, 2013 | Rolf Fredheim

Add references and a style sheet Below I briefly outline why Pandoc is an essential part of my research workflow, and demonstrate how to seamlessly integrate it with a bibliographic system and code written in R to produce high quality word or pdf documents. I also include all the functions ... [Read more...]

plot textual differences in Shiny

February 21, 2013 | Rolf Fredheim

Wordclouds such as Wordle are pretty rubbish, so I thought I'd try to make a better one, one that actually produces (statistically) meaningful results. I was so happy with the outcome I decided to make it interactive, so go on, have a play!Compare any two files texts (turns out ... [Read more...]

Modelling memory and news trajectories

February 6, 2013 | Rolf Fredheim

Modelling memory In the text below I present two models I've made to quantify and visualise the diverging trajectories of memory and news events, and conclude that linear regression may be used to test which model best describes the story. First, though, I contextualise this with an illustration from the ... [Read more...]

R and foreign characters

January 25, 2013 | Rolf Fredheim

Working with Russian characters can be mind-numbingly frustrating. This is true for R, as for other applications, so below I've written out the my top five tricks for making Russian inputs work in R; i believe they should be transferable to most other languages. Having forced any number of programs ... [Read more...]

Dynamically annotate graphs with Shiny

January 18, 2013 | Rolf Fredheim

Below I present a simple way to automatically annotate plots through Shiny It occurred to me that labeling plots should be really easy to do with R-studio's swanky 'Shiny' add on. To test this I gathered some time series data from Wikipedia, added opt...
[Read more...]
1 2

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)