- The API key wasn't in the shell environment. It lives in
~/.Renviron, so the scripts fall back to readingGOOGLE_API_KEYfrom there. - Find model IDs by listing them, not by guessing marketing names:
GET https://generativelanguage.googleapis.com/v1beta/models?pageSize=200(thedisplayNamefield maps the two). The ones used:
Statistical language R falls out of the TIOBE index top 20
After having been in the top 20 for about 3 years, statistical language R dropped out this month.
This is quite surprising because the field of statistical programming is still booming, especially thanks to the popularity of data mining and artificial intelligence.
Quiz: https://www.buzzfeed.com/laughingbunny255/what-percent-whimsy-are-you
The scoring is fully recoverable — the quiz data is embedded as JSON in the page
(data.type = "personality", 9 questions, 4 result buckets).
Each question has exactly 4 answers, and each answer is worth points: 1 toward
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 %>%