alpha

Sets coding standards for an AI assistant writing R, R Markdown and Quarto code: tidy style, pipes, reproducibility, safe inputs and performance.
description: 'R language and document formats (R, Rmd, Quarto): coding standards and Copilot guidance for idiomatic, safe, and consistent code generation.'
applyTo: '**/.R, **/.r, **/.Rmd, **/.rmd, **/*.qmd'
Help GitHub Copilot generate idiomatic, safe, and maintainable R code across projects.
%>% vs. |>), follow it.dplyr::mutate(), stringr::str_detect(). In project code, using library() is acceptable when that’s the repo norm.lower_snake_case for objects/files; avoid dots in names.setwd(); prefer project-relative paths (e.g., here::here()).withr::with_seed().eval(parse()), unvalidated shell calls, and unparameterized SQL.|> (R ≥ 4.1.0): Prefer in R ≥ 4.1 (no extra dependency).%>%: Continue using in projects already committed to magrittr or when you need features like ., %T>%, or %$%.|> and %>% within the same script unless there's a clear technical reason.data.table; benchmark with your workload.dtplyr to write dplyr syntax that translates to data.table operations automatically for performance gains.profvis::profvis() to identify performance bottlenecks in your code. Profile before optimizing.memoise::memoise() to cache expensive function results. Particularly useful for repeated API calls or complex computations.purrr::map_*() family or apply() family for remaining iteration needs.styler (tidyverse style), two-space indents, ~100-char lines.lintr configured via .lintr.precommit hooks to lint/format automatically.@param, @return, @examples).renv; snapshot after adding packages.fs and here for portability.data.frame() is fine.purrr in tidyverse code. In base-style code, prefer type-stable, vectorized patterns such as vapply()Map() (for elementwise operations) instead of explicit for loops when they improve clarity or performance.stringr/lubridate where already present; otherwise use clear base helpers (e.g., nchar(), substr(), as.Date() with explicit format).readr::read_csv()); make parsing assumptions explicit.ggplot2 for publication-quality plots. Keep layers readable and label axes and units.rlang::abort() / rlang::warn() for structured conditions; in base-only code, use stop() / warning().purrr::possibly() when you want a typed fallback value of the same type (simpler).purrr::safely() when you need to capture both results and errors for later inspection or logging.tryCatch() in base R for fine-grained control or compatibility with non-tidyverse code.processx::run() or sys::exec_wait() over system(); validate and sanitize all arguments.DBI queries to prevent SQL injection.fs::path_sanitize()), and validate against allowlists.Sys.getenv()), config outside VCS, or keyring.eventReactive() / observeEvent() for explicit dependencies.req() and clear, user-friendly messages.pool) for databases; avoid long-lived global objects.reactiveVal() / reactiveValues() for small state.echo, message, warning).withr::with_seed() for deterministic chunks.dplyr::across() instead of superseded verbs). If base-R style is present, use base idioms.dplyr::mutate()).# Base R variant
scores <- data.frame(id = 1:5, x = c(1, 3, 2, 5, 4))
safe_log <- function(x) tryCatch(log(x), error = function(e) NA_real_)
scores$z <- vapply(scores$x, safe_log, numeric(1))
# Tidyverse variant (if this file uses tidyverse)
result <- tibble::tibble(id = 1:5, x = c(1, 3, 2, 5, 4)) |>
dplyr::mutate(z = purrr::map_dbl(x, purrr::possibly(log, otherwise = NA_real_))) |>
dplyr::filter(z > 0)
# Example reusable helper with roxygen2 doc
#' Compute the z-score of a numeric vector
#' @param x A numeric vector
#' @return Numeric vector of z-scores
#' @examples z_score(c(1, 2, 3))
z_score <- function(x) (x - mean(x, na.rm = TRUE)) / stats::sd(x, na.rm = TRUE)
© GitHub, Inc. · MIT · source · posted by @OpenSourceBuffGuy on promptparty.com


Sea turtle carrying floating film studio island
Draws a giant sea turtle carrying a floating island film studio through a starry sky, where fairies polish rough film strips into golden film.
image-prompt, nano-banana, 3d-render, cartoon, fantasy-world, creatures, animals, whimsical, dreamy, cinematic, dramatic-lighting, vibrant-colors, bokeh, miniature, widescreen, night-scene, illustration, concept-art, surreal, storytelling, clay-3d

Desert buggy escapes drones past industrial outpost
Builds a 15-second desert chase video where a racer in an armored buggy escapes drones past an industrial outpost, using five reference images with set jobs.
video-prompt, hailuo, action, multi-shot, timed-beats, camera-movement, reference-image, character-consistency, negative-prompt, cinematic, sci-fi, cars, landscape, aerial-view, tracking-shot, photorealistic, sound-effects, structured-output, long-form, widescreen

Cozy Pixel Art Farm Island Village
Draws a cozy 16-bit pixel-art farming village across six small islands joined by bridges, with exact counts for buildings, animals and crops.
image-prompt, gpt-image, pixel-art, isometric, game-assets, concept-art, maps, worldbuilding, cozy, vibrant-colors, ocean, landscape, wide-shot, widescreen, game-development, video-games, structured-output, whimsical, summer, high-angle, aerial-view, animals, negative-prompt, cityscape
Loading reviews…
Loading comments…