Skip to content
Framework
Sign in Sign up

Search guides and reference for R, Python, Stata, the CLI, and Framework Cloud.

Structured workflows for statistics and data science

Framework gives every R, Python, and Stata project a proven structure and built-in data safeguards, with conventions ready for AI agents if you use them. Framework Cloud can start projects and publish results.

Load your project and publish a model
library(framework)scaffold() # Read cataloged datapenguins <- data_read("inputs.raw.penguins") # Fit a modelmodel <- lm(body_mass_g ~ flipper_length_mm + species,            data = penguins) # Publish itpublish(model, slug = "penguin-body-mass")
R, Python, and Stata examples

Scaffolding and analysis example

Best practices made easy

Framework's R, Python, and Stata packages give every project a sensible structure. Scripts start with one line. Data safeguards are built in. Framework Cloud makes starting projects and sharing results even easier.

Bootstrap every script or notebook with one line.

The scaffold() function sets up your environment, makes sure your packages are installed, and loads your project's functions. It replaces the source() and library() calls at the top of every script.

Without Framework

setwd("~/projects/penguin-study")readRenviron(".env")library(dplyr)library(ggplot2)source("R/clean.R")source("R/models.R")set.seed(123)theme_set(theme_minimal())

With Framework

library(framework)scaffold()

Read the documentation for R, Python, Stata, or the command line to see everything Framework can do.

Framework works with R, Python, Stata, and the command line

The same analysis in each language. Read the penguins dataset from the project's data catalog, summarize it, fit a model, and publish each result to its own link.

scripts/analysis.R

library(framework)scaffold() # Read a dataset from the project catalogpenguins <- data_read("inputs.raw.penguins")penguins # Summarize, fit, and plotby_species <- penguins |>  group_by(species) |>  summarize(n = n(), mean_mass_g = mean(body_mass_g, na.rm = TRUE))by_species model <- lm(body_mass_g ~ flipper_length_mm + species, data = penguins)summary(model) plot <- ggplot(penguins, aes(flipper_length_mm, body_mass_g)) +  geom_point(aes(color = species)) # Publish each onepublish(penguins, slug = "penguins")publish(by_species, slug = "mass-by-species")publish(model, slug = "penguin-body-mass")publish(plot, slug = "flipper-and-mass")
Data penguins
# A tibble: 344 × 8
   species island    bill_length_mm bill_depth_mm flipper_length_mm
   <chr>   <chr>              <dbl>         <dbl>             <dbl>
 1 Adelie  Torgersen           39.1          18.7               181
 2 Adelie  Torgersen           39.5          17.4               186
 3 Adelie  Torgersen           40.3          18                 195
 4 Adelie  Torgersen           NA            NA                  NA
…
Model summary(model)
Coefficients:
                   Estimate Std. Error t value Pr(>|t|)    
(Intercept)       -4031.477    584.151  -6.901 2.55e-11 ***
flipper_length_mm    40.705      3.071  13.255  < 2e-16 ***
speciesChinstrap   -206.510     57.731  -3.577 0.000398 ***
speciesGentoo       266.810     95.264   2.801 0.005392 ** 
…
Multiple R-squared:  0.7826,	Adjusted R-squared:  0.7807 

by_species

# A tibble: 3 × 3
  species       n mean_mass_g
  <chr>     <int>       <dbl>
1 Adelie      152       3701.
2 Chinstrap    68       3733.
3 Gentoo      124       5076.
Scatterplot of body mass against flipper length for 342 penguins, colored by species

Connect to Framework Cloud to reuse project settings and publish updates at the same link.

Framework keeps your project structured from start to finish

Start the project, run the analysis, and publish the results with one folder layout, one data catalog, and one set of settings.

01

Start your project

Build a project from trusted blueprints. Catalog your data, manage package dependencies, set safety guidelines, configure Quarto or Jupyter notebooks, and set up database connections in one place. Signed in to Framework Cloud, a new project starts from your saved blueprint.

R console
framework::new_project("penguin-study") # Signed in to Framework Cloud, the project starts# from your saved blueprint: its folders, package# list, and notebook settings. Open the files to see them. # Or use a project created in Cloudframework::new_project(key = "<project token>")

02

Conduct your analysis

Load your project settings and helper functions, read data by its catalog name, and check whether an input has changed.

scripts/analysis.R
library(framework) # Load all files in functions/.# Apply the configured ggplot theme.scaffold() # Read the input and record its hashpenguins <- data_read("inputs.raw.penguins")penguins <- add_body_mass_kg(penguins)model <- lm(body_mass_kg ~ flipper_length_mm + species, penguins)plot <- ggplot(penguins, aes(flipper_length_mm, body_mass_kg)) +  geom_point() # Verify that the input is unchangeddata_verify("inputs.raw.penguins")

functions/data_prep.R

# Sourced by scaffold()add_body_mass_kg <- function(data) {  # Body mass in kilograms  transform(data, body_mass_kg = body_mass_g / 1000)}

03

Publish your work

Publish a model from your script and share its link. Publish again with the same slug and collaborators get the latest version at that link.

scripts/analysis.R
publish(model, slug = "penguin-body-mass")
Published version 2: framework.pub/@examples/penguin-study/penguin-body-mass

Penguin body mass model Version 2

R · lm() · body_mass_g ~ flipper_length_mm + species

Term Estimate Std. error p-value
(Intercept) −4031.477 584.151 <0.001
flipper_length_mm 40.705 3.071 <0.001
speciesChinstrap −206.510 57.731 <0.001
speciesGentoo 266.810 95.264 0.005

Framework Cloud Helps You Manage All Your Projects

Framework Cloud is a companion web app for Framework. It stores your blueprints, AI skills, and project settings. It also lets you share your work securely.

Use it for free at framework.pub or host it on your own server.

Blueprints page with the Penguin lab blueprint, its project structure, and its packages

See what each blueprint makes: folders, packages, agents, and skills.

Use AI agents as an interface to Framework Cloud

Connect Claude or ChatGPT to Framework Cloud. Your agent can work with your projects, published results, and reports, and Framework's skills keep its code to your project's conventions.

Reports from your results

The agent reads your published tables, models, and figures, then writes a report around them. Every number comes from an artifact.

Projects and blueprints

Describe the project you need. The agent proposes a blueprint, shows its files, and saves it when you agree.

Publishing from your computer

In Claude Code or Codex, the agent publishes notebooks and figures straight from your project.

Access you choose

You approve each agent with full or read-only access. Reports stay private until you publish them.

Claude, connected to Framework Cloud
Write a short report on the penguin body mass model from my published results.
  1. artifacts_list Penguin study: 3 artifacts
  2. artifacts_show penguin-body-mass, version 2
  3. reports_create Penguin body mass (private draft)

I drafted Penguin body mass with the model table and the flipper figure from your project.

Each extra millimeter of flipper length goes with 40.7 g more body mass (SE 3.1), holding species fixed. The model explains 78% of the variance.

The draft is private. Publish it when you're ready.

Penguin body mass
Report · 2 artifacts · Private draft

Agent skills

Framework provides skills for R, Python, and Stata, including plotting skills for ggplot2, matplotlib, and Stata graphs. Create your own and share them across projects.

.claude/skills/ggplot2-figures/SKILL.md
---name: ggplot2-figuresdescription: Use when making a ggplot2 figure in R, from a quick look at the data to a figure for a paper, report, poster, or slides. Covers choosing the chart, accurate defaults, titles and labels, accessible color, honest scales, themes, and saving.metadata:  title: Figures with ggplot2  summary: Accurate ggplot2 figures, from exploring data to publication.--- # Figures with ggplot2 ## Chart choice Values on a shared axis are the easiest to compare. | Question | Chart | ggplot2 ||---|---|---|| Distribution of one numeric variable | Histogram | `geom_histogram()` || A numeric variable across groups | Box plot, or violin plot with the points | `geom_boxplot()`, `geom_violin()`, `geom_jitter()` || Counts by category | Bar chart, sorted | `geom_col()` or `geom_bar()` || Two numeric variables | Scatterplot | `geom_point()`, optionally `geom_smooth()` || Change over time or another ordered variable | Line chart | `geom_line()` with `geom_point()` || Two estimates across many groups | Dot plot | `geom_point()` with `geom_segment()` || A pattern across subgroups | Small multiples | `facet_wrap()` or `facet_grid()` | Avoid dual y axes and 3-D effects. In a stacked bar, only the bottom segmentsits on a shared baseline. ## Accuracy - **Histograms:** try more than one bin width. The default of 30 bins can  hide or invent features. Set `binwidth` in the units of the variable.- **Group summaries:** a box plot hides group size and multiple peaks. With a  few hundred points or fewer, add them with  `geom_jitter(width = 0.2, alpha = 0.3)`.- **Overplotting:** lower `alpha`, use smaller points, or use `geom_bin2d()`  or `geom_hex()`.- **Skewed variables:** use `scale_x_log10()` or `scale_y_log10()` for  strongly right-skewed values. Say so in the axis label.- **Bars:** a bar's length encodes its value, so the axis starts at zero. Use  points when zero is not meaningful.- **Order:** sort categories by value with `forcats::fct_reorder()` unless  they have a natural order.- **Missing-value codes:** check the codebook for codes such as -99 before  plotting, and recode them to missing.- **Missing values:** ggplot2 drops rows with missing values and warns. Count  what was dropped before you trust the figure.- **Panels:** panels that readers compare share axis limits, the  `facet_wrap()` default. Use `scales = "free"` only for panels not meant to  be compared, and say so in the caption. ## Titles and labels - **Axes:** use plain names with units, such as "Income per person (US  dollars, log scale)". Replace column names such as `sbp_mean`.- **Title:** a title that states the finding, such as "Blood pressure rises  with age in every group", can help a figure communicate its result. Make  sure it suits the venue. Some journals and readers prefer a matter-of-fact  title that names the variables, such as "Systolic blood pressure by age".  Follow the venue's style, and ask the user when it is unclear. Do not  invent a finding.- **Subtitle and caption:** say what is measured, for whom, and when. Give  the data source, the sample size, and caveats such as the handling of  missing values.- **Direct labels:** with a few series, label lines or points directly with  `geom_text()` or `geom_label()` and remove the legend. Use  `ggrepel::geom_text_repel()` when labels overlap.- **Reference values:** draw them with `geom_hline()` or `geom_vline()`, and  label the line.- **Uncertainty:** show it with the same method and interval level as the  analysis. Label a confidence interval as uncertainty in the estimate. ## Color - For categories, use a palette readable with color vision deficiency, such  as Okabe-Ito or `scale_color_viridis_d()`. For ordered values, use  `scale_fill_viridis_c()` or a single-hue sequential scale.- Pair color with labels, position, or shape, so the figure still works in  grayscale. ## Themes A shared theme is a good tactic when a project makes many figures. It keepsthem consistent and saves repeating the same settings. Define the look once asa function and apply it to each figure. If the project already has a theme,use it. A one-off figure can set its theme directly. ## Saving Set the width and height when saving, and check the saved file. Text thatreads well on screen can be too small at column width. In a Framework project,save figures with `save_figure(plot, "name", width = , height = )`. 

Start a Framework project

Set a project up in Framework Cloud or create it on your computer with the R or Python package or the command line.

Pick a blueprint

Choose a blueprint, adjust its settings, and see every file before the project is made.

Put it on GitHub

Framework Cloud creates the repository. Clone it to start working.

username/penguin-study git clone https://github.com/username/penguin-study.git

Download a ZIP

Download the project files and unpack them on your computer.

Get started with Framework