This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#' | |
#' This is a test using the `testthat` package for R | |
#' | |
#' @title Test whether developers forgot a browser() debug statement in their R package code | |
#' | |
#' @description | |
#' Test goal: Check all functions of the encompassing R package | |
#' for whether developers forgot a browser()-statement | |
#' while debugging. | |
#' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# we simulate a data set with an alphanumeric ID column and some | |
# observed values x | |
# The goal is to give out new participant IDs with consecutive numbers | |
# starting from 1 (while maintaining the original order) | |
dat <- data.frame(id=c("P1","P1","P1","second","second","second","3rd","no4","no4"), | |
x=rnorm(9)) | |
# convert IDs to a factor and then use position of factor level as new ID | |
# /!\ this yields ID that are according to alphanumeric sorting of original IDs | |
dat$numeric_id <- as.numeric(factor(dat$id)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# This is a Dockerfile to create a Fedora Linux environment | |
# with the latest version of BGGM from Donald's github repository | |
# | |
FROM rhub/fedora-clang-devel | |
ARG BUILD_DATE=2021-07-25 | |
RUN dnf install R -y | |
RUN sudo dnf install 'dnf-command(copr)' -y | |
RUN sudo dnf copr enable iucar/cran -y | |
RUN sudo dnf install R-CoprManager -y |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(rtweet) | |
library(stringr) | |
# get last 100 tweets | |
tweets <- search_tweets("jonasobleser",n = 100) | |
# extract numbers with one or more digits | |
numbers <- sapply(tweets$text, | |
function(x) { | |
as.numeric(str_extract(x, "([0-9]+)")) | |
}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# define colors | |
dark.green<-"#48631A" | |
light.green<-"#87B13F" | |
# hex sticker library | |
library(hexSticker) | |
# public domain image source: | |
# https://publicdomainvectors.org/en/free-clipart/Vector-clip-art-of-oaktree-with-wide-treetop/24731.html | |
imgurl<-"https://publicdomainvectors.org/photos/tree-oak400px.png" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# provides function position_jitter_gaussian() for ggplot2 | |
# | |
# Use parameters width and height for scaling of dispersion | |
# | |
# Example: | |
#df <- data.frame( | |
# x = rep(c(1,3,2,5,5,5,5),5), | |
# y = rep(c(1,3,2,5,5,5,5),5) | |
#) |