Currently three main styles:
- Autocomplete
- e.g. github copilot, windsurf
- Inline "ghost text" as you type
- Sometimes amazingly good; often pretty useless
- Need to train yourself to ignore spurious suggestions
Convert <ingredients>
to JSON using the following format:
If an ingredient has both weight and volume, extract only the weight:
¾ cup (150g) dark brown sugar
[{"name": "dark brown sugar", "quantity": 150, "unit": "g"}]
If an ingredient only lists a volume, extract that.
library(tidyverse) | |
# https://twitter.com/buddyherms/status/1576966150680121344 -------------- | |
# PROs: at, by, and regexp examples | |
# CONs: quite simple | |
vt_census <- tidycensus::get_decennial( | |
geography = "block", | |
state = "VT", |
f1 <- function(n) { | |
x <- numeric() | |
for (i in 1:n) { | |
x <- c(x, i) | |
} | |
x | |
} | |
f1.5 <- function(n) { | |
x <- numeric() |
data(diamonds, package = "ggplot2") | |
# Most straightforward | |
diamonds$ppc <- diamonds$price / diamonds$carat | |
# Avoid repeating diamonds | |
diamonds$ppc <- with(diamonds, price / carat) | |
# The inspiration for dplyr's mutate | |
diamonds <- transform(diamonds, ppc = price / carat) |
library(rtweet) | |
library(tidyverse) | |
auth_setup_default() | |
json <- search_tweets("#rstats", n = 5000, include_rts = FALSE, parse = FALSE)[1:5] | |
tweets <- tibble(json = json) %>% | |
unnest_wider(json) %>% | |
select(statuses) %>% | |
unnest_longer(statuses) %>% |
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 %>%
library(ggplot2) | |
x <- c("بقرة", "دجاج", "حصان") | |
df <- data.frame(x = x, y = 1:3) | |
labels_rtl <- function(x) paste0("\u202B", x) | |
ggplot(df, aes(x, y)) + | |
geom_point() + | |
scale_x_discrete(labels = labels_rtl) + |
# 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") |
# Code for quick exploration of | |
# https://github.com/rfordatascience/tidytuesday/tree/master/data/2020/2020-05-26 | |
# Video at https://youtu.be/kHFmtKCI_F4 | |
library(tidyverse) | |
cocktails <- readr::read_csv("boston_cocktails.csv") | |
# Are name and row_id equivalent? ----------------------------------------- |