I’ve been using GNU+Linux distros for about 10 years now, and have settled for openSUSE as my main operating system around 3 years ago, perhaps even more. If you’re a gamer, you might have heard about SteamOS
and how more and more games are available on GNU+Linux. I don’t really care about
games, I play the occasional one (currently Tangledeep) when I find
the time, but still follow the news about gaming on GNU+Linux. Last week,
Valve announced something quite big; it is now possible to run Windows games on GNU+Linux directly
from Steam, using a modified version of Wine
they call Proton. The feature is still in Beta, and Valve announced that they guarantee around
30 games to work already flawlessly. Of course, people have tried running a lot of other games, and,
as was to be expected from Free Software and Open Source fans, GNU+Linux gamers created a Google Sheet
that lists which games were tried and how they run. You can take a look at the sheet here.
In this blog post, I will play around with this sheet. This blog post lists some {tidyverse} tricks
I find useful and use often. Perhaps these tricks will be useful to you too! Let’s start by loading
the needed packages:
library(tidyverse)
library(magrittr)
library(readxl)
Since I’m lazy and don’t want to type the whole name of the file I’ll be using some little regex:
steam %
count(Game)
## # A tibble: 3,855 x 2
## Game n
## ## 1 .hack//G.U. Last Recode 2
## 2 $1 Ride 1
## 3 0rbitalis 1
## 4 10 Second Ninja 4
## 5 100% Orange Juice 17
## 6 1000 Amps 3
## 7 12 Labours of Hercules VII: Fleecing the Fleece (Platinum Edition) 1
## 8 16bit trader 1
## 9 1849 1
## 10 1953 - KGB Unleased 1
## # ... with 3,845 more rows
That’s quite a lot of games! However, not everyone of them is playable:
steam %__%
count(Status)
## # A tibble: 8 x 2
## Status n
## ## 1 Borked 205
## 2 bronze 1
## 3 Bronze 423
## 4 Garbage 2705
## 5 Gold 969
## 6 Platinum 2596
## 7 Primary 1
## 8 Silver 1670
Around 2500 have the status “Platinum”, but some games might have more than one status:
steam %__%
filter(Game == &quot;100% Orange Juice&quot;) %__%
count(Status)
## # A tibble: 5 x 2
## Status n
## ## 1 Bronze 5
## 2 Garbage 3
## 3 Gold 2
## 4 Platinum 6
## 5 Silver 1
More games run like Garbage than Platinum. But perhaps we can dig a little deeper and see if
we find some patterns.
Let’s take a look at the GNU+Linux distros:
steam %__%
count(Distro) ## # A tibble: 2,085 x 2
## Distro n
## ## 1 ? 2
## 2 &quot;\&quot;Arch Linux\&quot; (64 bit)&quot; 1
## 3 &quot;\&quot;Linux Mint 18.3 Sylvia 64bit&quot; 1
## 4 &quot;\&quot;Manjaro Stable 64-bit (Kernel 4.14.66)&quot; 1
## 5 &quot;\&quot;Solus\&quot; (64 bit)&quot; 2
## 6 (K)ubuntu 18.04 64-bit (Kernel 4.15.0) 2
## 7 (L)Ubuntu 18.04.1 LTS 1
## 8 18.04.1 1
## 9 18.04.1 LTS 2
## 10 18.04.1 LTS (64 Bit) 1
## # ... with 2,075 more rows
Ok the distro column is pretty messy. Let’s try to bring some order to it:
steam %%
mutate(distribution = as_factor(case_when(
grepl(&quot;buntu|lementary|antergos|steam|mint|18.|pop|neon&quot;, Distro, ignore.case = TRUE) ~ &quot;Ubuntu&quot;,
grepl(&quot;arch|manjaro&quot;, Distro, ignore.case = TRUE) ~ &quot;Arch Linux&quot;,
grepl(&quot;gentoo&quot;, Distro, ignore.case = TRUE) ~ &quot;Gentoo&quot;,
grepl(&quot;fedora&quot;, Distro, ignore.case = TRUE) ~ &quot;Fedora&quot;,
grepl(&quot;suse&quot;, Distro, ignore.case = TRUE) ~ &quot;openSUSE&quot;,
grepl(&quot;debian|sid|stretch|lmde&quot;, Distro, ignore.case = TRUE) ~ &quot;Debian&quot;,
grepl(&quot;solus&quot;, Distro, ignore.case = TRUE) ~ &quot;Solus&quot;,
grepl(&quot;slackware&quot;, Distro, ignore.case = TRUE) ~ &quot;Slackware&quot;,
grepl(&quot;void&quot;, Distro, ignore.case = TRUE) ~ &quot;Void Linux&quot;,
TRUE ~ &quot;Other&quot;
)))
The %% operator is shorthand for a % f(). It passes a to f() and assigns the
result back to a. Anyways, let’s take a look at the distribution column:
steam %__%
count(distribution)
## # A tibble: 10 x 2
## distribution n
## ## 1 Ubuntu 6632
## 2 Arch Linux 805
## 3 Solus 175
## 4 Debian 359
## 5 Fedora 355
## 6 Gentoo 42
## 7 Void Linux 38
## 8 Other 76
## 9 openSUSE 66
## 10 Slackware 22
I will group distributions that have less than 100 occurrences into a single category
(meaning I will keep the 5 more common values):
steam %%
mutate(distribution = fct_lump(distribution, n = 5, other_level = &quot;Other&quot;)) steam %__%
count(distribution)
## # A tibble: 6 x 2
## distribution n
## ## 1 Ubuntu 6632
## 2 Arch Linux 805
## 3 Solus 175
## 4 Debian 359
## 5 Fedora 355
## 6 Other 244
Let’s do the same for the CPUs:
steam %%
mutate(CPU = as_factor(case_when(
grepl(&quot;intel|i\\d|xeon|core2|\\d{4}k|q\\d{4}|pentium&quot;, Specs, ignore.case = TRUE) ~ &quot;Intel&quot;,
grepl(&quot;ryzen|threadripper|tr|amd|fx|r\\d|\\d{4}x|phenom&quot;, Specs, ignore.case = TRUE) ~ &quot;AMD&quot;,
TRUE ~ NA_character_
)))
steam %__%
count(CPU)
## # A tibble: 3 x 2
## CPU n
## ## 1 Intel 5768
## 2 AMD 2319
## 3 483
And the same for the GPUs:
steam %%
mutate(GPU = as_factor(case_when(
grepl(&quot;nvidia|geforce|3\\d{2}|nouveau|gtx|gt\\s?\\d{1,}|9\\d0|1060|1070|1080&quot;, Specs, ignore.case = TRUE) ~ &quot;Nvidia&quot;,
grepl(&quot;amd|radeon|ati|rx|vega|r9&quot;, Specs, ignore.case = TRUE) ~ &quot;AMD&quot;,
grepl(&quot;intel|igpu|integrated|hd\\d{4}|hd\\sgraphics&quot;, Specs, ignore.case = TRUE) ~ &quot;Intel&quot;,
TRUE ~ NA_character_
)))
steam %__%
count(GPU)
## # A tibble: 4 x 2
## GPU n
## ## 1 Nvidia 6086
## 2 AMD 1374
## 3 Intel 413
## 4 697
I will also add a rank for the Status column:
steam %%
mutate(rank_status = case_when(
Status == &quot;Platinum&quot; ~ 5,
Status == &quot;Gold&quot; ~ 4,
Status == &quot;Silver&quot; ~ 3,
Status == &quot;Bronze&quot; ~ 2,
Status == &quot;Garbage&quot; ~ 1
))
Now, what are the top 5 most frequent combinations of Status, distribution, CPU and GPU?
steam %__%
filter(!is.na(CPU), !is.na(GPU)) %__%
count(Status, distribution, CPU, GPU) %__%
mutate(total = sum(n)) %__%
mutate(freq = n / total) %__%
top_n(5)
## Selecting by freq
## # A tibble: 5 x 7
## Status distribution CPU GPU n total freq
## ## 1 Garbage Ubuntu Intel Nvidia 1025 7443 0.138 ## 2 Gold Ubuntu Intel Nvidia 361 7443 0.0485
## 3 Platinum Ubuntu Intel Nvidia 1046 7443 0.141 ## 4 Platinum Ubuntu AMD Nvidia 338 7443 0.0454
## 5 Silver Ubuntu Intel Nvidia 650 7443 0.0873
Unsurprisingly, Ubuntu, or distributions using Ubuntu as a base, are the most popular ones. Nvidia
is the most popular GPU, Intel for CPUs and in most cases, this combo of hardware and distribution
is associated with positive ratings (even though there are almost as many “Garbage” ratings than
“Platinum” ratings).
Now let’s compute some dumb averages of Statuses by distribution, CPU and GPU. Since I’m going
to run the same computation three times, I’ll write a function to do that.
compute_avg %
group_by((!!var)) %__%
mutate(wt = n()) %__%
summarise(average_rating = weighted.mean(rank_status, (!!var), wt, na.rm = TRUE))
}
Let’s see now if we can rank distribution by Steam play rating:
compute_avg(steam, distribution)
## # A tibble: 6 x 2
## distribution average_rating
## ## 1 Ubuntu 3.03
## 2 Arch Linux 3.05
## 3 Solus 3.03
## 4 Debian 3.01
## 5 Fedora 3.07
## 6 Other 3.16
How about for hardware?
compute_avg(steam, GPU)
## # A tibble: 4 x 2
## GPU average_rating
## ## 1 Nvidia 3.07
## 2 AMD 2.90
## 3 Intel 3.01
## 4 NA
compute_avg(steam, CPU)
## # A tibble: 3 x 2
## CPU average_rating
## ## 1 Intel 3.03
## 2 AMD 3.06
## 3 NA
To wrap this up, what are the games with the most ratings? Perhaps this can give us a hint about which
games GNU+Linux users prefer:
steam %__%
count(Game) %__%
top_n(10)
## Selecting by n
## # A tibble: 10 x 2
## Game n
## ## 1 Age of Empires II: HD Edition 43
## 2 Borderlands 39
## 3 DiRT 3 Complete Edition 32
## 4 DOOM 62
## 5 Fallout: New Vegas 45
## 6 Grim Dawn 34
## 7 No Man's Sky 40
## 8 Path of Exile 35
## 9 Quake Champions 32
## 10 The Elder Scrolls V: Skyrim 46
I actually laughed out loud when I saw that DOOM was the game with the most ratings! What else
was I expecting, really.
If you found this blog post useful, you might want to follow me on twitter
for blog post updates.