Rcrastinate is moving.
Hi all, this is just an announcement.
I am moving Rcrastinate to a blogdown-based solution and am therefore leaving blogger.com.
10 years of playback history on Last.FM: "Just sit back and listen"
Alright, seems like this is developing into a blog where I am increasingly investigating my own music listening habits.
Recently, I've come across the analyzelastfm package by Sebastian Wolf. I used it to download my complete listening history from Last.FM for the last ten years.
This dance, it's like a weapon: Radiohead's and Beck's danceability, valence, popularity, and more from the LastFM and Spotify APIs
Giddy up, giddy it up
Wanna move into a fool's gold room
With my pulse on the animal jewels
Of the rules that you choose to use to get loose
With the luminous moves
Bored of these limits, let me get, let me get it like
Wow!
When it comes to surreal lyrics and videos, I'm always thinking of Be
Network visualization of football transfers using the 'visNetwork' package
Click here for the interactive visualization
If you're interested in the visualisation of networks or graphs, you might've heard of the great package "visNetwork". I think it's a really great package and I love playing around with it.
Send tweets from R: A very short walkthrough
There are a few reasons why you might want to send tweets from R. You might want to write a Twitter bot or - as in my case - you want to send yourself a tweet when a very long computation finishes.
Get your tracks from the Strava API and plot them on Leaflet maps
Here is some updated R code from my previous post. It doesn't throw any warnings when importing tracks with and without heart rate information. Also, it is easier to distinguish types of tracks now (e.g., when you want to plot runs and rides separately).
3Where do you run to? Map your Strava activities on static and Leaflet maps.
So, Strava's heatmap made quite a stir the last few weeks. I decided to give it a try myself. I wanted to create some kind of "personal heatmap" of my runs, using Strava's API.
Substitute levels in a factor or character vector
I've been using the ggplot2 package a lot recently. When creating a legend or tick marks on the axes, ggplot2 uses the levels of a character or factor vector. Most of the time, I am working with coded variables that use some abbreviation of the "true" meaning (e.g.
What's in the words? Comparing artists and lyrics with R.
It's been a while since I had the opportunity to post something on music. Let's get back to that.
I got my hands on some song lyrics by a range of artists. (I have an R script to download all lyrics for a given artist from a lyrics website.
Plotting GPX tracks with Shiny and Leaflet
Lately, I got the chance to play around with Shiny and Leaflet a lot - and it is really fun! So I decided to catch up on an old post of mine and build a Shiny application where you can upload your own GPX files and plot them directly in the browser.
9Visualisation of Likert scale results
[EDIT: The function now also inludes the possibility to plot the IQR around the median. I shifted the median slightly downwards to prevent the SD and the IQR from overlapping.]
I wrote a function to visualise results of Likert scale items. Please find the function below the post.
Troubles with cell labels in mosaic plots... and how to solve them.
Today I want to write about a solution to a quite specific problem. Suppose, you want to label cells in your 'vcd' package mosaic plots in a custom way. For example, we might want to use cell labels which indicate "too much" or "too few" cases (given your expected values).
3Just plot this...
png("goodbye.png", height = 625, width = 500)
par(col = "purple")
plot(1, 1, xlim = c(0,800), ylim = c(0,1600), type = "n", bty = "n", xaxt = "n", yaxt = "n", xlab = "", ylab = "")
symbols(x = 400, y = 1200, circles = 400, add = T, lwd = 40)
lines(x = c(400, 400), y = c(900, 100), lwd = 40, lend
Do basic R operations much faster in bash [Slightly off-topic]
R is great, and you can do a LOT OF stuff with it.
However, sometimes you want to do really basic stuff with huge or a lot of files. At work, I have to do that a lot because I am mostly dealing with language data that often needs some pre-processing.
Stop fiddling around with copied paths in Windows R
I work with R on both Mac OS and Windows. On Windows, you get the option to copy the path of a file or folder by holding Shift while right-clicking on the file or folder. As useful as this feature is, it copies paths to your clipboard in Windows format, e.g.
4Time series analysis with R: Testing stuff with NetAtmo data
I've got a NetAtmo weather station. One can download the measurements from its web interface as a CSV file.
5Changing the font of R base graphic plots.
Want to change the font used in your R plots? I got a quite simple solution that works on Mac OS.
You need the function 'quartzFonts'. With this function, you can define additional font families to use in your R base graphic plots. The default font families are 'sans', 'serif' and 'mono'.
Mapping the world with tweets
A few days ago, I collected 30 minutes of tweets all around the world. I used the twitteR and streamR packages for this. The nice thing about those tweets is that they have geo-information associated with them. Not all of them, of course, but more than enough.
Stay on track: Plotting GPS tracks with R
Many GPS devices and apps have the capability to track your current position via GPS. If you go walking, running, cycling, flying or driving, you can take a look at your exact route and your average speed.
5Getting emotional in the absence of something: Using the Berlin Affective Word List to analyze emotional valence and arousal for nouns and adjectives.
This is something I did a while ago using the Berlin Affective Word List (BAWL).
The BAWL contains ratings for 2902 German words (2107 nouns, 504 verbs, 291 adjectives). Ratings were collected for emotional valence (bad vs.
Hyperthreading FTW? Testing parallelization performance in R.
Alright, let's test some parallelization functionalities in R.
The machine:
MacBook Air (mid-2013) with 8 GB of RAM and the i7 CPU (Intel i7 Haswell 4650U). This CPU is hyper-threaded, meaning (at least that's my understanding of it) that it has two physical cores but can run up to four threads.
Catching errors in R and trying something else
I recently encountered some functionality in R which most of you might already know. Nevertheless, I want to share it here, because it might come in handy for those of you who do not know this yet.
Suppose you want to read in a large number of very large text tables in R.
The 'Deutsche Bahn' (German Railway Corp.) is always late!!1! Or is it? And if, why?
The biggest German railway company, the 'Deutsche Bahn', is subject of frequent emotional discussions about being late all the time. A big German newspaper, the Süddeutsche Zeitung built the so-called 'train monitor' (Zugmonitor).
No surprises: More people tweet more. Visualizing twitter counts during election day.
As if the R world needed another example of Twitter visualizations, right? Well, here we go anyway.
At the beginning of 2013, Pablo Barberá released the first version of his R package 'streamR' (CRAN link). With this package, you can tap into the streaming capabilities of the Twitter API.
XML in R - A (German) tutorial / XML in R - ein Tutorial auf Deutsch
I used knitr to hack together a very short tutorial about XML in R.
It's in German. And it's not very long. But, hey, it's free :)
I hope it can be of help to someone who wants to get started with XML processing in R.
Please feel free to post or send any comments about the thing.
The rbinding race: for vs. do.call vs. rbind.fill
Which function rbinds dataframes together fastest?
First competitor: classic rbind in a for loop over a list of dataframes
Second competitor: do.call("rbind", <list of dataframes>)
Third competitor: rbind.fill(<list of dataframes>) from the plyr package
The job:
- rbinding a list of dataframes
Funky music in funky months: Does my taste of music change over the year?
I already introduced some stuff I did with the last.fm API. But did you ever wonder if your taste of music changes over the year? Sunny music in the sunny months and dark music in darker months? Well, I did. And I want to check it out with the RLastFM package and some additional functions.
3TeXing R tables: Save yourself a lot of typing...
I want to share a function I wrote for my dissertation. The function is useful for putting up to two R tables into one TeX table.
You have to load the package 'languageR' to have the dataset 'dative' available.
Peace through Music. Country clustering using R and the last.fm API
last.fm is an internet radio and music suggestion service. Registered users can also use last.fm to 'scrobble' tracks they've been listening to. last.fm then keeps track of a user's statistics in terms of top artists, albums and tracks.
"I don't wanna grow up": Age / value relationships for football players
Let's get back to the age-value relationship from my last post. I did some more plotting to see on which position this inversed U-shaped relationship is strongest.
The "golden age" of a football player
It's been some time since my last post on football. And we're talking about european soccer here.
So I finally managed to write some functions which allow me to extract player stats from www.transfermarkt.de. The site tracks lots of stats in the world of soccer.
R-bloggers
As long as I can't find the time to post my newest adventuRes, why don't you check out the great collection of other R-blogs on the web:
www.r-bloggers.com
Have fun!
"The Dude" takes the Tarantino threshold
Just as a quick reply to a friend of mine who suggested testing the swearing capabilities of The Dude:
Click to enlarge.
As you can see, "The Big Lebowski" (2.79 % swear words) takes the Tarantino threshold (0.98 %) easily, but it's no match against "Reservoir Dogs" (3.28 %).
Fun stuff with subtitles or "The Tarantino Threshold"
Fortunately, there is a page called www.opensubtitles.org, where you can get subtitle (.SRT) files for virtually every movie. Now let's see what we can do with these. SRT files are in plain text format (human readable) and can thus be read quite easily with R.
Creating PDFs and websites with the "knitr" package
Just a fast note: I came across the R-package "knitr" which enables you to generate PDF files by mixing LaTeX and R code in one document. The result looks very nice and is great to create documentations, manuals and so on.
Add a comment