# Articles by Johannes B. Gruber on Johannes B. Gruber

### Let users choose which plot you want to show

July 27, 2021 |

If you have build your homepage using blogdown, it’s actually quite simple to integrate Javascript snippets in it. While this is mentioned in the book “blogdown: Creating Websites with R Markdown”, it still took me a little bit to undertstand how i...

### Get all your packages back on R 4.0.0

April 26, 2020 |

R 4.0.0 was released on 2020-04-24. Among the many news two stand out for me: First, R now uses stringsAsFactors = FALSE by default, which is especially welcome when reading in data (e.g., via read.csv) and when constructing data.frames. The second news that caught my eye was that ... [Read more...]

### (Much) faster unnesting with data.table

October 20, 2019 |

Today I was struggling with a relatively simple operation: unnest() from the tidyr package. What it’s supposed to do is pretty simple. When you have a data.frame where one or multiple columns are lists, you can unlist these columns while duplicating the information in other columns if the ... [Read more...]

### Introducing rwhatsapp

September 22, 2019 |

I’m happy to announce that rwhatsapp is now on CRAN. After being tested by users on GitHub for a year now, I decided it is time to make the package available to a wider audience. The goal of the package is to make working with ‘WhatsApp’ chat logs as ...

### Introducing rwhatsapp

September 22, 2019 |

I’m happy to announce that rwhatsapp is now on CRAN. After being tested by users on GitHub for a year now, I decided it is time to make the package available to a wider audience. The goal of the package is to make working with ‘WhatsApp’ chat logs as ...

### You R my Valentine!

February 13, 2019 |

Today is Valentine’s Day. And since both I and my sweetheart are R enthusiasts, here is how to say “I love you” using a statistical programming language:
library("dplyr")
library("gganimate")
library("ggplot2")

hrt_dat <- data.frame(t = seq(0, 2 * pi, by = 0.01)) %>%
bind_rows(data.frame(t = rep(max(.$t), 300))) %>% mutate(xhrt = 16 * sin(t) ^ 3, yhrt = 13 * cos(t) - 5 * cos(2 * t) - 2 * cos(3 * t) - cos(4 * t), frame = seq_along(t)) %>% mutate(text = ifelse(frame > 300, " J", "")) %>% mutate(text = ifelse(frame > 500, "A J", text)) %>% mutate(text = ifelse(frame > 628, "A + J", text)) %>% mutate(texty = 0, textx = 0) ggplot(hrt_dat, aes(x = xhrt, y = yhrt)) + geom_line(colour = "#C8152B") + geom_polygon(fill = "#C8152B") + geom_text(aes(x = textx, y = texty, label = text), size = 18, colour = "white", vjust = "center") + theme_void() + transition_reveal(frame) [Read more...] ### You R my Valentine! February 13, 2019 | Today is Valentine’s Day. And since both I and my sweetheart are R enthusiasts, here is how to say “I love you” using a statistical programming language: library("dplyr") library("gganimate") library("ggplot2") hrt_dat <- data.frame(t = seq(0, 2 * pi, by = 0.01)) %>% bind_rows(data.frame(t = rep(max(.$t), 300))) %>%
mutate(xhrt = 16 * sin(t) ^ 3,
yhrt = 13 * cos(t) - 5 * cos(2 * t) - 2 * cos(3 * t) - cos(4 * t),
frame = seq_along(t)) %>%
mutate(text = ifelse(frame > 300, "            J", "")) %>%
mutate(text = ifelse(frame > 500, "A           J", text)) %>%
mutate(text = ifelse(frame > 628, "A     +     J", text)) %>%
mutate(texty = 0, textx = 0)

ggplot(hrt_dat, aes(x = xhrt, y = yhrt)) +
geom_line(colour = "#C8152B") +
geom_polygon(fill = "#C8152B") +
geom_text(aes(x = textx, y = texty, label = text),
size = 18,
colour = "white",
vjust = "center") +
theme_void() +
transition_reveal(frame)

### Smarter Wordclouds

February 1, 2019 |

Some time ago, I saw a presentation by Wouter van Atteveldt who showed that wordclouds aren’t necessarily stupid. I was amazed since wordclouds were one of the first things I ever did in R and they are still often shown in introductions to text analysis. But the way they ...

### Smarter Wordclouds

February 1, 2019 |

Some time ago, I saw a presentation by Wouter van Atteveldt who showed that wordclouds aren’t necessarily stupid. I was amazed since wordclouds were one of the first things I ever did in R and they are still often shown in introductions to text analysis. But the way they ...

### (Mis)using Discourse Network Analyzer for manual coding

September 11, 2018 |

For my PhD project, I want to use Supervised Machine Learning (SML) to replicate my manual coding efforts onto a larger data set. That means, however, that I need to put in some manual coding effort before the SML algorithms can do their magic! I used ... [Read more...]

### (Mis)using Discourse Network Analyzer for manual coding

September 11, 2018 |

For my PhD project, I want to use Supervised Machine Learning (SML) to replicate my manual coding efforts onto a larger data set. That means, however, that I need to put in some manual coding effort before the SML algorithms can do their magic! I used ...

### (Mis)using Discourse Network Analyzer for manual coding

September 11, 2018 |

For my PhD project, I want to use Supervised Machine Learning (SML) to replicate my manual coding efforts onto a larger data set. That means, however, that I need to put in some manual coding effort before the SML algorithms can do their magic! I used ...

### LexisNexisTools. My first R package

May 18, 2018 |

My PhD supervisor once told me that everyone doing newspaper analysis starts by writing code to read in files from the ‘LexisNexis’ newspaper archive. However, while I do recommend this exercise, not everyone has the time. These are the first words of the introduction to my first R package, LexisNexisTools. ...

### LexisNexisTools. My first R package

May 18, 2018 |

My PhD supervisor once told me that everyone doing newspaper analysis starts by writing code to read in files from the ‘LexisNexis’ newspaper archive. However, while I do recommend this exercise, not everyone has the time. These are the first words of the introduction to my first R package, LexisNexisTools. ...

### Highly Similar Texts

May 16, 2018 |

Available solutions: the accurate one Available solutions: the fast one Divide and conquer Implementation in LexisNexisTools A while ago I was building a database of newspaper articles retrieved from LexisNexis for a research project in which I was working as a research assistant. At some point we noticed that we ... [Read more...]

### Highly Similar Texts

May 16, 2018 |

A while ago I was building a database of newspaper articles retrieved from LexisNexis for a research project in which I was working as a research assistant. At some point we noticed that we seemed to have a lot of duplicates in our database. I had already removed the duplicates ... [Read more...]
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 1, "mathjax_display_tex": 0, "mathjax_asciimath": 1, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.5087841749191284, "perplexity": 3103.862031984532}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2021-39/segments/1631780060677.55/warc/CC-MAIN-20210928092646-20210928122646-00325.warc.gz"}