r-spatial

r-spatial is a skill for Claude Code, Codex from LeoLin990405/r-analytics-skill. It costs 23 tokens per session (1,157 once invoked), scanned A, original, MIT.

A collection of R packages and techniques for working with geographic data, maps, geographic shapes, and spatial statistics.

In plain words
What is it for?
Use it to manipulate map features and raster grids, create interactive or thematic maps, and analyse spatial patterns or relationships.
Why use it?
It brings together tools for analysing location-based data instead of treating it as ordinary tables alone.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/leolin990405/r-analytics-skill/r-spatial
Any agent
npx skills add LeoLin990405/r-analytics-skill --skill r-spatial
Clone the repo
git clone --depth 1 https://github.com/LeoLin990405/r-analytics-skill

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for r-spatial

README.md
[![agentmods](https://agentmods.dev/badge/skills/leolin990405/r-analytics-skill/r-spatial.svg)](https://agentmods.dev/skills/leolin990405/r-analytics-skill/r-spatial)
Your own site
<a href="https://agentmods.dev/skills/leolin990405/r-analytics-skill/r-spatial"><img src="https://agentmods.dev/badge/skills/leolin990405/r-analytics-skill/r-spatial.svg" alt="Measured on agentmods" height="20"></a>
Per session 23 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,157 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00023 $0.01157
Opus 5 $0.00012 $0.00579
Sonnet 5 $0.00005 $0.00231
Haiku 4.5 $0.00002 $0.00116

Measured 2d ago against content hash c8190097db3d, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, from the pricing page.

Security

Grade A, and why

r-spatial scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

sub-skills/r-spatial/SKILL.md · 188 lines

How it starts

The opening of the file, as written. The whole thing — 188 lines — stays where its author put it; the contents beside it link to each section on GitHub.

R Spatial Analysis Skill

Sub-skills

Sub-skill Description
r-spatial-vector sf, sp, terra vectors, geometric operations
r-spatial-raster terra, raster, stars, gridded data
r-spatial-mapping tmap, leaflet, mapview, ggplot2+sf

Geographic and spatial data analysis in R.

Core Spatial Packages

Package Description
sf Simple Features for R (modern)
terra Spatial data analysis (raster/vector)
sp Classes for spatial data (legacy)
rgdal Geospatial Data Abstraction Library
rgeos Geometry Engine - Open Source

Mapping & Visualization

Package Description
leaflet Interactive maps
tmap Thematic maps
ggmap Maps with ggplot2
maptools Spatial object tools
RColorBrewer Color schemes for maps
REmap ECharts maps

Spatial Statistics

Package Description
spatstat Spatial point pattern analysis
gstat Geostatistical modeling
spdep Spatial dependence
GWmodel Geographically-weighted models

Spatio-temporal

Package Description
spacetime Spatio-temporal data

Data Sources

Package Description
tigris US Census TIGER shapefiles
rnaturalearth Natural Earth map data
osmdata OpenStreetMap data

Quick Examples

# sf basics
library(sf)

# Read shapefile
shp <- st_read("data.shp")

# Read GeoJSON
geo <- st_read("data.geojson")

# Create from coordinates
points <- st_as_sf(df, coords = c("lon", "lat"), crs = 4326)

# Coordinate reference systems
st_crs(shp)
shp_transformed <- st_transform(shp, crs = 3857)

# Spatial operations
st_intersection(a, b)
st_union(a, b)
st_buffer(points, dist = 1000)
st_area(polygons)
st_distance(a, b)

# Spatial joins
st_join(points, polygons)

# Interactive map with leaflet
library(leaflet)
leaflet(shp) %>%
  addTiles() %>%
  addPolygons(
    fillColor = ~colorQuantile("YlOrRd", value)(value),
    weight = 1,
    popup = ~name
  )

# Static map with tmap
library(tmap)
tm_shape(shp) +
  tm_polygons("value",
    style = "quantile",
    palette = "Blues",
    title = "Value"
  ) +
  tm_layout(title = "Map Title")

# ggplot2 + sf
library(ggplot2)
ggplot(shp) +
  geom_sf(aes(fill = value)) +
  scale_fill_viridis_c() +
  theme_minimal()

# Spatial statistics
library(spdep)
# Create neighbors
nb <- poly2nb(shp)
# Spatial weights
lw <- nb2listw(nb)
# Moran's I
moran.test(shp$value, lw)

# Geostatistics
library(gstat)
# Variogram
v <- variogram(value ~ 1, data = points)
plot(v)
# Kriging
v.fit <- fit.variogram(v, vgm("Sph"))
kriged <- krige(value ~ 1, points, grid, v.fit)

Read the full file on GitHub · 188 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 188 lines · 23 tokens per session scan A c8190097db3d

Subscribe to this mod's changes

r-spatial is a skill published in the GitHub repository LeoLin990405/r-analytics-skill (5 stars, last pushed 5mo ago), licensed MIT. It adds 23 tokens to every session and 1,157 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.

Related

Other skills, from other repositories

bio-applied-bio-data-formats

Parse/write FASTA, FASTQ, SAM/BAM, VCF, BED, GFF/GTF with pysam and pure Python; decode SAM FLAG/CIGAR; reconcile 0-based vs 1-based coordinates. Use for custom format parsers or off-by-one coordinate bugs.

Pavel-Kravchenko/Bioinformatics · 67 tokens

bio-applied-cancer-transcriptomics

Classify tumor RNA-seq into subtypes (melanoma Tirosh/Harbst on TCGA-SKCM): log1p/z-score, PCA/t-SNE, hierarchical clustering, random forest, Kaplan-Meier survival. Use when subtyping cBioPortal expression data.

Pavel-Kravchenko/Bioinformatics · 67 tokens

bio-applied-mageck-gene-essentiality

Run MAGeCK count/test on pooled CRISPR sgRNA screens, scoring gene essentiality via RRA, FDR, and log2 fold-change. Use when analyzing CRISPR screen FASTQ/count data, calling essential or drug-resistance genes, or benchmarking vs DepMap.

Pavel-Kravchenko/Bioinformatics · 69 tokens

bio-applied-molecular-evolution

Test Hardy-Weinberg equilibrium, simulate Wright-Fisher drift/selection, and compute dN/dS, Tajima's D, and Fst with NumPy/SciPy. Use for neutral theory, molecular clock divergence time, selection scans, or effective population size (Ne) questions.

Pavel-Kravchenko/Bioinformatics · 67 tokens

bio-applied-network-modules

Detect PPI/co-expression modules with NetworkX/python-louvain/leidenalg (Louvain, Leiden, modularity Q) and WGCNA eigengenes. Use when clustering a gene network, computing WGCNA modules, or testing DEG/pathway enrichment on network communities.

Pavel-Kravchenko/Bioinformatics · 65 tokens

bio-applied-ribo-seq

Ribo-seq: cutadapt/bowtie2 adapter+rRNA removal, plastid P-site calibration, 3-nt periodicity QC, RiboCode/ribotricer ORF calling, translation efficiency. Use when user has ribosome profiling or footprint data.

Pavel-Kravchenko/Bioinformatics · 64 tokens