library(tidyverse)
simple_data <- tibble(
group = factor(rep(c("A", "B"), each = 15)),
subject = 1:30,
score = c(rnorm(15, 40, 20), rnorm(15, 60, 10))
)
simple_data_se <- simple_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
library(httr) | |
library(digest) | |
library(XML) | |
s3_request <- function(verb, bucket, path = "/", query = NULL, | |
content = NULL, date = NULL) { | |
list( | |
verb = verb, | |
bucket = bucket, | |
path = path, |
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
library("shiny") | |
x <- runApp(shinyApp( | |
fluidPage( | |
"Password:", | |
tags$input(id = "password", type = "password"), | |
actionButton("done", "Done") | |
), | |
function(input, output) { | |
observe({ |
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
R_COMPLETION=FALSE | |
R_LIBS=~/R | |
TMPDIR=/tmp | |
_R_CHECK_FORCE_SUGGESTS_=false | |
GITHUB_PAT=[redacted] | |
DO_PAT=[redacted] |
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
library(tidyverse) | |
library(gapminder) | |
gapminder | |
gapminder <- gapminder %>% mutate(year1950 = year - 1950) | |
# Nested data ------------------------------------------------------------- | |
by_country <- gapminder %>% | |
group_by(continent, country) %>% |
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
# need + validate ----------------------------------------------------------- | |
validate( | |
need( | |
mzfinder::check_mzr_object(ms_object$mzr_connection), | |
"Wasn't able to connect to MS file" | |
) | |
) | |
validate( | |
need(!is.null(input$ppm_input), "ppm_input must not be null"), | |
need(input$ppm_input > 0L, "ppm_input must be > 0") |
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
# ======================================= | |
# = Enhancements to data tidying = | |
# = Hadley Wickham = | |
# = https://rstd.io/tidyhancements-2019 = | |
# ======================================= | |
# What is tidy data? ---------------------------------------------------------- | |
# 1. Each column is a variable. | |
# 2. Each row is an observation. | |
# 3. Each cell is a value. |
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
library(dplyr, warn.conflicts = FALSE) | |
library(gapminder) | |
probs <- c(0.1, 0.5, 0.9) | |
gapminder %>% | |
group_by(continent) %>% | |
summarise( | |
probs = probs, | |
across(is.numeric & !year, ~ quantile(.x, probs)) | |
) |
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
library(tidyverse) | |
library(gh) | |
library(lubridate) | |
library(glue) | |
repo <- tibble(json = unclass(gh("/user/repos", .limit = Inf))) | |
repo <- repo %>% | |
hoist(json, | |
owner = c("owner", "login"), |
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
#' @include DBConnection.R | |
NULL | |
#' Generate SQL: CREATE TABLE | |
#' | |
#' @param conn A subclass of \code{\linkS4class{DBIConnection}} describing | |
#' an active database connection. | |
#' @param name A string giving the table name to create. Escaped with | |
#' \code{\link{dbQuoteIdentifier}} | |
#' @param fields,types Character vectors of equal lengths giving the names |