Articles by schochastics

New RStudio addins for network analysis

September 3, 2019 | schochastics

A new version of the snahelper package is now available on CRAN. If you do not now the package: So far, it included one RStudio addin that provided a GUI to analyze and visualize networks. Check out the introductory post for more details. This major... [Read more...]

graphlouts v0.5.0 released

August 24, 2019 | schochastics

A new version of graphlayouts is now available on CRAN. This major update introduces several new layout algorithms and adds additional support for weighted networks. Here is a breakdown of all changes: BREAKING CHANGE: removed qgraph(). Now part of ggraph. POSSIBLE BREAKING CHANGE: layout_with_focus() now also returns the ...
[Read more...]

Mapping NBA Shot Locations

June 28, 2019 | schochastics

I recently came across the article “How Mapping Shots In The NBA Changed It Forever” and although I am not a big basketball fan, I was impressed by the visualizations. I actually bought the book “Sprawlball” by Kirk Goldsberry afterwards, where this was taken from. I can only recommend it, ... [Read more...]

Introducing graphlayouts with Game of Thrones

April 13, 2019 | schochastics

This post introduces the new R package graphlayouts which is available on CRAN since a few days. We will use network data from the Game of Thrones TV series (seemed timely at the time of writing) to illustrate the core layout algorithms of the package. Most of the algorithms use ... [Read more...]

An Rstudio Addin for Network Analysis and Visualization

January 25, 2019 | schochastics

The ggraph package provides a ggplot-like grammar for plotting graphs and as such you can produce very neat network visualizations. But as with ggplot, it takes a while to get used to the grammar. There are already a few amazing Rstudio Addins that assist you with ggplot (for example ggplotAssist ... [Read more...]

Network Centrality in R: New ways of measuring Centrality

December 11, 2018 | schochastics

This is the third post of a series on the concept of “network centrality” with applications in R and the package netrankr. The last part introduced the concept of neighborhood-inclusion and its implications for centrality. In this post, we extend the concept to a broader class of dominance relations by ... [Read more...]

Network Centrality in R: Neighborhood Inclusion

December 9, 2018 | schochastics

This is the second post of a series on the concept of “network centrality” with applications in R and the package netrankr. The first part briefly introduced the concept itself, relevant R package, and some reoccurring issues for applications. This post will discuss some theoretical foundations and common properties of ... [Read more...]

Network Centrality in R: An Introduction

December 6, 2018 | schochastics

This is the first post of a series on the concept of “network centrality” with applications in R and the package netrankr. There is already a rudimentary tutorial for the package, but I wanted to extend it to a broader tutorial for network centrality. The main focus of the blog ... [Read more...]

Beautiful Chaos: The Double Pendulum

November 21, 2018 | schochastics

This post is dedicated to the beautiful chaos created by double pendulums. I have seen a great variety of animated versions, implemented with different tool but never in R. Thanks to the amazing package gganimate, it is actually not that hard to produce them in R.
library(tidyverse)
library(gganimate)
I am not ... [Read more...]

Rdew Valley: Optimizing Farming with R

November 13, 2018 | schochastics

I recently picked up a copy of my favorite game Stardew Valley again. If you don’t know the game, I can highly recommend it! You inherit a pixel farm and you are in charge of everything. Crops, animals, fishing, mining and never forget to socialize. My plan was to ... [Read more...]

Analyzing the Greatest Strikers in Football II: Visualizing Data

October 6, 2018 | schochastics

This is the second part of Analyzing the Greatest Strikers in Football. In the first part, we created the function get_goals() which allows us to conveniently scrape detailed information of players career goals from transfermarkt.co.uk. In this part, we are going to explore the data.
library(tidyverse) # for data wrangling
library(lubridate) # for date formats
library(ggimage)   # adding images to ggplot
library(patchwork) # attaching ggplot objects
library(viridis)   # viridis color schemes
We ... [Read more...]

Six Degrees of Zlatan Ibrahimovic

September 27, 2018 | schochastics

This post is based on the Six Degrees of Kevin Bacon which itself is an adoption of the Erdős number in math. Readers familiar with the concepts can skip the following paragraph and go directly to the calculation of the Zlatan number. I have done this before on my ...
[Read more...]

Stress based graph layouts

September 12, 2018 | schochastics

I academically grew up among graph drawers, that is, computer scientists and mathematicians interested in deriving two-dimensional depictions of graphs. One may despicably call it pixel science, yet a lot of hard theoretical work is put into producing pretty graph layouts. Although I am not at all an expert in ... [Read more...]

Fast Fiedler Vector Computation

June 23, 2018 | schochastics

This is a short post on how to quickly calculate the Fiedler vector for large graphs with the igraph package.
#used libraries
library(igraph)    # for network data structures and tools
library(microbenchmark)    # for benchmark results
Fiedler Vector with eigen My goto approach at the start was using the eigen() function to compute the whole spectrum of the Laplacian Matrix.
g <- sample_gnp(n = 100,p = 0.1,directed = FALSE,loops = FALSE)
M <- laplacian_matrix(g,sparse = FALSE)
spec <- eigen(M)
comps <- sum(round(spec$values,8)==0)
fiedler <- spec$vectors[,comps-1]
While this is easy ... [Read more...]

Analyzing NBA Player Data III: Similarity Networks

March 9, 2018 | schochastics

This is the last part of the mini series Analysing NBA Player data. The first part was concerned with scraping and cleaning player statistics from any NBA season. The second part showed how to use principal component analysis and k means clustering to “revolutionize” player positions. Which kind of failed. ... [Read more...]

Analyzing NBA Player Data II: Clustering Players

March 3, 2018 | schochastics

This is the second post of my little series Analyzing NBA player data. The first part was concerned with scraping and cleaning player statistics from any NBA season. This post is dealing with gaining some inside in the player stats. In particular, clustering players according to their stats to produce ... [Read more...]

Analyzing NBA Player Data I: Getting Data

March 2, 2018 | schochastics

As a football (soccer) data enthusiast, I have always been jealous of the amount of available data for American sports. While much of the interesting football data is proprietary, you can can get virtually anything of interest for the NBA, MLB, NFL or NHL. I have decided to move away ... [Read more...]

Using UMAP in R with rPython

February 13, 2018 | schochastics

I wrote about dimensionality reduction methods before and now, there seems to be a new rising star in that field, namely the Uniform Manifold Approximation and Projection, short UMAP. The paper can be found here, but be warned: It is really math-heavy. From the abstract: UMAP is constructed from a ... [Read more...]

Sample Entropy with Rcpp

February 6, 2018 | schochastics

Entropy. I still shiver when I hear that word, since I never fully understood that concept. Today marks the first time I was kind of forced to look into it in more detail. And by “in detail”, I mean I found a StackOverflow question that had something to do with ... [Read more...]
1 2 3

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)