Skip to content

Instantly share code, notes, and snippets.

@joranE
joranE / keybase.md
Created January 16, 2024 14:39
Keybase verification step

Keybase proof

I hereby claim:

  • I am jorane on github.
  • I am joranelias (https://keybase.io/joranelias) on keybase.
  • I have a public key ASBf7pR-dvux36P98pkeVIx0OUJyng-p22wZSKjR-9sTbAo

To claim this, I am signing this object:

@joranE
joranE / create_spec.R
Last active March 4, 2020 21:58
Create column spec for a data frame not already read in by readr
create_spec <- function(x,condense = TRUE){
v_inherits <- Vectorize(FUN = inherits,vectorize.args = "what")
col_map <- c(logical = "l",
integer = "i",
numeric = "d",
factor = "f",
character = "c",
Date = "D",
POSIXct = "T")
x_spec <- rep("?",times = ncol(x))
dat <- structure(list(rank = c("1 ", "1 ", "1 "), bib = c("1 ", "1 ",
"1 "), `fis code` = c("3422819 ", "3422819 ", "3422819 "), name = c("KLAEBO Johannes Hoesflot ",
"KLAEBO Johannes Hoesflot ", "KLAEBO Johannes Hoesflot "), nsa = c("NOR ",
"NOR ", "NOR "), `7.35km` = c("3 ", "18:30.8 ", "10 "), `11.1km` = c("18 ",
"28:39.5 ", ""), `22.3 km` = c("2 ", "57:36.8 ", "12 "), `26.1km` = c("7",
"1:07:08.1 ", "4"), finish = c("1:16:47.1 ", "1:16:47.1 ", "1:16:47.1 "
), fis = c("0.00", "0.00", "0.00"), grp = c(1L, 1L, 1L), val = c("split_rank",
"split_time", "split_bonus")), .Names = c("rank", "bib", "fis code",
"name", "nsa", "7.35km", "11.1km", "22.3 km", "26.1km", "finish",
"fis", "grp", "val"), row.names = c(NA, -3L), class = c("grouped_df",
@joranE
joranE / facet_axis_labs.R
Created October 23, 2017 16:05
Obscure ggplot faceting bug?
library(ggplot2)
# x axis tick labels for '4' panel, overlapping '6' facet label?
ggplot(mtcars,aes(mpg,disp)) +
facet_wrap(~cyl,dir = "v",nrow = 2,as.table = F) +
geom_point()
@joranE
joranE / gaps.R
Created June 5, 2017 00:23
Plotting irregular times series with predictable gaps
dat <- structure(list(date = structure(c(14645, 14590, 14577, 14569,
14289, 14261, 14226, 14219, 14213, 14205, 14295, 14655, 14660,
14933, 14940, 14941, 14954, 14961, 14974, 14975, 14977, 14980,
14982, 14983, 15024, 15032, 15034, 15045, 15051, 15052, 15053,
15297, 15304, 15305, 15318, 15325, 15337, 15338, 15340, 15342,
15344, 15346, 15347, 15361, 15374, 15375, 15381, 15402, 15409,
15668, 15675, 15687, 15690, 15703, 15704, 15708, 15709, 15710,
15711, 15753, 15759, 15767, 15774, 15780, 16039, 16040, 16046,
16102, 16110, 16115, 16124, 16487, 16491, 16502, 16767, 16768,
16774, 16781, 16789), class = "Date"), y = c(-2.4215, -2.7139,
@joranE
joranE / inline.Rmd
Created March 13, 2017 22:37
Inline Rmd numeric formatting...?
---
title: "Test"
author: "Test"
date: "March 13, 2017"
output: pdf_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```