Skip to content

Instantly share code, notes, and snippets.

View freestatman's full-sized avatar
💭
just typing some R code...

Freeman Wang freestatman

💭
just typing some R code...
View GitHub Profile
@dedlim
dedlim / claude_3.5_sonnet_artifacts.xml
Last active October 31, 2025 15:35
Claude 3.5 Sonnet, Full Artifacts System Prompt
<artifacts_info>
The assistant can create and reference artifacts during conversations. Artifacts are for substantial, self-contained content that users might modify or reuse, displayed in a separate UI window for clarity.
# Good artifacts are...
- Substantial content (>15 lines)
- Content that the user is likely to modify, iterate on, or take ownership of
- Self-contained, complex content that can be understood on its own, without context from the conversation
- Content intended for eventual use outside the conversation (e.g., reports, emails, presentations)
- Content likely to be referenced or reused multiple times
@psolymos
psolymos / r-apis
Last active April 3, 2023 19:33
Hello world examples with different R web frameworks
# httpuv
library(httpuv)
handle <- function(req) {
input <- req[["rook.input"]]
postdata <- input$read_lines()
jsonlite::toJSON(paste0("Hello ",
jsonlite::fromJSON(paste(postdata)), "!"))
}
httpuv::runServer(
host = "0.0.0.0",
library(dplyr)
library(arrow)
library(duckdb)
# install.packages(c("dplyr", "arrpw", "duckdb", "nycflights13"))
## Export the nycflights13 dataset to arrow format ----
nycflights13::flights |>
@AlbertRapp
AlbertRapp / twitter_tracking.R
Last active May 12, 2022 23:49
Get Dataviz from Twitter into your note-taking system using R
### Change these parts here ----------------------------------------------------
# Set to your working directory where there is a template.md file
setwd(here::here())
# Locations
vault_location <- stop('Add Vault Location') # Location of markdown files
attachments_dir <- stop('Add Vault Subdirectory Location') # subdirectory of vault_location for png-files
imap_mail <- stop('Set imap mail client') # mail client
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# ##### ### # #####
# # # # # # # # #
# # # # # # # #
# ##### # # # # #####
# # # # ####### # #
# # # # # # #
# ####### ### # #####
@topepo
topepo / two_class_diag_plots.R
Created May 6, 2021 22:00
two class diagnostic plots for shinymodels
library(tidymodels)
tidymodels_prefer()
theme_set(theme_bw())
library(doMC)
registerDoMC(cores = 20)
# ------------------------------------------------------------------------------
data(ad_data)
library(shiny)
library(jsonlite)
# we'll store received data in a local json file
write_json(list(), "data.json")
post_handler <- function(req, response) {
# we'll catch everything that's POST for this demo but you'll want to make
# sure you don't step on shiny's built-in POST handlers
# (I'm pretty sure this handler is called after shiny's handlers but :shrug:)
@CorradoLanera
CorradoLanera / app-future-into-api.R
Last active October 12, 2022 14:31
Shiny + future + plumber
#
# This is a Shiny web application. You can run the application by
# clicking the 'Run App' button above.
#
# Find out more about building applications with Shiny here:
#
# http://shiny.rstudio.com/
#
library(shiny)
@navicore
navicore / nvim-r.txt
Last active August 3, 2025 04:00
R cheatsheet and nvim-r commands
Menu entry Default shortcut~
Start/Close
. Start R (default) \rf
. Start R (custom) \rc
--------------------------------------------------------
. Close R (no save) \rq
. Stop (interrupt) R :RStop
-----------------------------------------------------------

App Install Plan

Critical