This file contains 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
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
#' Create a CSS ruleset | |
#' | |
#' Create a CSS ruleset consisting of a selector and one-or-more property declarations, | |
#' or, if no \code{.selector} is given, create an inline style string | |
#' | |
#' The list of included properties is not a complete list, but rather an | |
#' abbreviated list from | |
#' \url{https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Properties_Reference} |
This file contains 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
f <- function(...) { | |
function(df) with(df, ...) | |
} | |
footate <- function(.data, ...) { | |
dots <- list(...) | |
for (column in names(dots)) { | |
.data[[column]] <- dots[[column]](.data) | |
} |
This file contains 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
download.file("https://ndownloader.figshare.com/articles/5170705/versions/1", "kd.zip") | |
unzip("kd.zip") | |
library(readr) | |
words <- readr::read_csv("KSP-Word.csv") | |
users <- readr::read_csv("KSP-User.csv") | |
entries <- readr::read_csv("KSP-Entry.csv") | |
keypress <- readr::read_csv("KSP-KeyPress.csv") | |
pressure <- readr::read_csv("KSP-Pressure.csv") |
This file contains 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
dat <- readr::read_csv("municipality\n- Ticino\n>> Distretto di Bellinzona\n......5001 Arbedo-Castione\n......5002 Bellinzona\n......5003 Cadenazzo\n......5004 Camorino\n") | |
dat %>% mutate(municipality = gsub(pattern = '[\\.\\>]|^-', | |
replacement = "", | |
municipality)) %>% | |
separate(col = municipality, | |
sep = '(?<=[0-9])\\s', | |
into = c ("code","municipality"), | |
fill = "left") |
This file contains 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
matrix_to_df_firstline_header <- function(mat){ | |
requireNamespace("purrr") | |
mat %>% | |
## cut columns into lists | |
apply(2, function(s) list(s)) %>% | |
flatten %>% | |
map(flatten_chr) %>% | |
## set names to the first element of the list | |
{set_names(x = map(., ~ .x[-1]), |
NewerOlder