| Title: | Structured Data Science Project Scaffolding |
|---|---|
| Description: | Project scaffolding and workflow tools for reproducible data science. Manages packages, tracks data integrity, handles database connections, generates notebooks, and publishes to S3-compatible storage. More information at <https://framework.table1.org>. |
| Authors: | Erik Westlund [aut, cre, cph] |
| Maintainer: | Erik Westlund <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 1.0.2 |
| Built: | 2026-05-12 09:10:52 UTC |
| Source: | https://github.com/table1/framework |
Add project to global configuration
add_project_to_config(project_dir, project_name = NULL, project_type = NULL)add_project_to_config(project_dir, project_name = NULL, project_type = NULL)
project_dir |
Path to project directory |
project_name |
Optional project name |
project_type |
Optional project type |
Invisibly returns the project ID
Generates a complete AI context file (CLAUDE.md, AGENTS.md, etc.) from scratch for a new project. The content is tailored to the project type and configuration.
ai_generate_context( project_path = ".", project_name = NULL, project_type = NULL, config = NULL )ai_generate_context( project_path = ".", project_name = NULL, project_type = NULL, config = NULL )
project_path |
Path to the project directory (default: current directory) |
project_name |
Name of the project (for header) |
project_type |
Project type: "project", "project_sensitive", "course", "presentation" |
config |
Project configuration (if NULL, reads from settings.yml) |
Character string with the complete AI context content
if (FALSE) { # Generate AI context for current project content <- ai_generate_context() # Generate for a specific project type content <- ai_generate_context(project_type = "project_sensitive") }if (FALSE) { # Generate AI context for current project content <- ai_generate_context() # Generate for a specific project type content <- ai_generate_context(project_type = "project_sensitive") }
Updates only the sections marked with <!-- @framework:regenerate --> in an
existing AI context file, preserving user customizations in unmarked sections.
ai_regenerate_context(project_path = ".", sections = NULL, ai_file = NULL)ai_regenerate_context(project_path = ".", sections = NULL, ai_file = NULL)
project_path |
Path to the project directory |
sections |
Which sections to regenerate. NULL = all regeneratable sections. Options: "environment", "packages", "data", "functions" |
ai_file |
Name of the AI context file (default: from settings or "CLAUDE.md") |
Invisible TRUE on success
if (file.exists("CLAUDE.md")) { # Regenerate all dynamic sections ai_regenerate_context() # Regenerate only packages section ai_regenerate_context(sections = "packages") }if (file.exists("CLAUDE.md")) { # Regenerate all dynamic sections ai_regenerate_context() # Regenerate only packages section ai_regenerate_context(sections = "packages") }
Copies content from the canonical AI assistant file to all other AI files, adding a warning header to non-canonical files.
ai_sync_context(config_file = NULL, force = FALSE, verbose = TRUE)ai_sync_context(config_file = NULL, force = FALSE, verbose = TRUE)
config_file |
Path to configuration file (default: auto-detect settings.yml/settings.yml) |
force |
Logical; if TRUE, overwrite even if target is newer (default: FALSE) |
verbose |
Logical; if TRUE (default), show sync messages |
This function reads the ai.canonical_file setting from settings.yml and
copies its content to all other AI assistant instruction files that exist
in the project.
The canonical file is copied as-is. Non-canonical files receive a warning header indicating they are auto-synced and should not be edited directly.
Supported files:
AGENTS.md - Cross-platform AI assistants
CLAUDE.md - Claude Code
.github/copilot-instructions.md - GitHub Copilot
Invisible list with sync results
if (FALSE) { # Sync AI context files ai_sync_context() # Force sync even if targets are newer ai_sync_context(force = TRUE) # Silent sync (for git hooks) ai_sync_context(verbose = FALSE) }if (FALSE) { # Sync AI context files ai_sync_context() # Force sync even if targets are newer ai_sync_context(force = TRUE) # Silent sync (for git hooks) ai_sync_context(verbose = FALSE) }
Cache a value
cache(name, value, file = NULL, expire_after = NULL)cache(name, value, file = NULL, expire_after = NULL)
name |
The cache name |
value |
The value to cache |
file |
Optional file path to store the cache (default: |
expire_after |
Optional expiration time in hours (default: from config) |
The cached value
Clear all cached values
cache_flush()cache_flush()
Invisibly returns NULL.
Remove a cached value
cache_forget(name, file = NULL)cache_forget(name, file = NULL)
name |
The cache name to remove |
file |
Optional file path of the cache (default: |
Invisibly returns NULL.
Get a cached value
cache_get(name, file = NULL, expire_after = NULL)cache_get(name, file = NULL, expire_after = NULL)
name |
The cache name |
file |
Optional file path to store the cache (default: |
expire_after |
Optional expiration time in hours (default: from config) |
The cached value, or NULL if not found, expired, or hash mismatch
Returns a data frame of all cache entries with their names, expiration times, and status (expired or active).
cache_list()cache_list()
A data frame with columns:
Cache key name
Expiration timestamp (NA if no expiration)
When the cache was created
When the cache was last updated
When the cache was last read
Either "active" or "expired"
Returns an empty data frame if no cache entries exist.
if (FALSE) { # List all cache entries cache_list() # Filter to see only expired caches cache_list() |> dplyr::filter(status == "expired") }if (FALSE) { # List all cache entries cache_list() # Filter to see only expired caches cache_list() |> dplyr::filter(status == "expired") }
Attempts to retrieve a cached value by name. If the cache doesn't exist, is expired, or a refresh is requested, evaluates the expression and caches the result. This is the primary caching interface for expensive computations.
cache_remember( name, expr, file = NULL, expire_after = NULL, refresh = FALSE, expire = NULL )cache_remember( name, expr, file = NULL, expire_after = NULL, refresh = FALSE, expire = NULL )
name |
The cache name (non-empty string identifier) |
expr |
The expression to evaluate and cache if cache miss occurs. Expression is evaluated in the parent frame. |
file |
Optional file path to store the cache
(default: |
expire_after |
Optional expiration time in hours (default: from config). Character durations like "1 day" or "2 hours" are accepted. |
refresh |
Optional boolean or function that returns boolean to force refresh. If TRUE or if function returns TRUE, cache is invalidated and expression is re-evaluated. |
expire |
Optional alias for |
The cached value (if cache hit) or the result of evaluating expr (if cache miss or refresh requested)
if (FALSE) { # Cache expensive computation result <- cache_remember("my_analysis", { expensive_computation() }) # Force refresh when data changes result <- cache_remember("analysis", { run_analysis() }, refresh = file.mtime("data.csv") > cache_time) }if (FALSE) { # Cache expensive computation result <- cache_remember("my_analysis", { expensive_computation() }) # Force refresh when data changes result <- cache_remember("analysis", { run_analysis() }, refresh = file.mtime("data.csv") > cache_time) }
Capture console output and errors from an expression
capture_output(expr)capture_output(expr)
expr |
Expression to evaluate |
List containing status (boolean), console_output (character vector), and result (return value or error)
Unified function for reading and writing global Framework settings to ~/.frameworkrc.json. This function provides a single source of truth for global configuration, used by both the CLI and GUI interfaces.
configure_global(settings = NULL, validate = TRUE)configure_global(settings = NULL, validate = TRUE)
settings |
List. Settings to update (partial updates supported) |
validate |
Logical. Validate settings before saving (default: TRUE) |
author - Author information (name, email, affiliation)
defaults - Project defaults
project_type - Default project type ("project", "presentation", "course")
notebook_format - Default notebook format ("quarto", "rmarkdown")
ide - IDE preference ("vscode", "rstudio", "both", "none")
use_git - Initialize git repositories by default
use_renv - Enable renv by default
seed - Default random seed
seed_on_scaffold - Set seed during scaffold()
ai_support - Enable AI assistant support
ai_assistants - List of AI assistants ("claude", "agents", etc.)
ai_canonical_file - Canonical AI instruction file
packages - Default package list
directories - Default directory structure
git_hooks - Git hook preferences
projects - Registered projects list
active_project - Currently active project path
Invisibly returns updated global configuration
if (FALSE) { # Update author information configure_global(settings = list( author = list( name = "Jane Doe", email = "[email protected]" ) )) # Update default project type configure_global(settings = list( defaults = list( project_type = "presentation" ) )) # Get current settings (read-only) current <- configure_global() }if (FALSE) { # Update author information configure_global(settings = list( author = list( name = "Jane Doe", email = "[email protected]" ) )) # Update default project type configure_global(settings = list( defaults = list( project_type = "presentation" ) )) # Get current settings (read-only) current <- configure_global() }
Prints both database connections defined under connections: and object
storage profiles (S3-compatible buckets). Use this to see everything Framework
can talk to from your config.
connections_list()connections_list()
Invisibly returns NULL after printing summaries.
Functions for connecting to and interacting with S3-compatible storage.
Registers an existing data file with the Framework data catalog. This allows
you to track files that were created outside of Framework (e.g., downloaded
from external sources, copied from other projects) and use them with
data_read() using dot notation.
data_add( file_path, name = NULL, type = NULL, delimiter = "comma", locked = TRUE, update_config = TRUE )data_add( file_path, name = NULL, type = NULL, delimiter = "comma", locked = TRUE, update_config = TRUE )
file_path |
Path to the existing file (must exist) |
name |
Optional dot notation name for the data catalog (e.g., |
type |
Optional type override. Auto-detected from file extension if NULL. |
delimiter |
Delimiter for CSV files ("comma", "tab", "semicolon", "space") |
locked |
Whether the file should be locked (hash-verified on read) |
update_config |
If TRUE (default), also updates the YAML config with the data spec |
Invisibly returns the data spec that was created
if (FALSE) { # Add a downloaded CSV file to the catalog data_add("inputs/raw/survey_results.csv", name = "inputs.raw.survey_results") # Now you can read it with dot notation data_read("inputs.raw.survey_results") # Add with auto-generated name data_add("inputs/intermediate/cleaned_data.rds") # Name will be derived as "inputs.intermediate.cleaned_data" }if (FALSE) { # Add a downloaded CSV file to the catalog data_add("inputs/raw/survey_results.csv", name = "inputs.raw.survey_results") # Now you can read it with dot notation data_read("inputs.raw.survey_results") # Add with auto-generated name data_add("inputs/intermediate/cleaned_data.rds") # Name will be derived as "inputs.intermediate.cleaned_data" }
Gets the data specification for a given dot notation path from settings.yml. Supports dot notation (e.g., "source.private.example"), relative paths, and absolute paths. Auto-detects file type from extension and applies intelligent defaults for common formats.
data_info(path)data_info(path)
path |
Dot notation path (e.g. "source.private.example"), relative path, or absolute path to a data file |
A list with data specification including:
path - Full file path
type - File type (csv, rds, stata, spss, sas, etc.)
delimiter - Delimiter for CSV files (comma, tab, etc.)
locked - Whether file is locked for integrity checking
private - Whether file is in private data directory
description - Optional description of the dataset (displayed when loading)
if (FALSE) { # Get info from dot notation info <- data_info("source.private.my_data") # Get info from file path info <- data_info("data/public/example.csv") }if (FALSE) { # Get info from dot notation info <- data_info("source.private.my_data") # Get info from file path info <- data_info("data/public/example.csv") }
Lists all data specifications defined in the configuration, showing the data key, path, type, and description (if available).
data_list()data_list()
A data frame with columns: name, path, type, locked, description
if (FALSE) { # List all data entries data_list() # Use the alias list_data() }if (FALSE) { # List all data entries data_list() # Use the alias list_data() }
Supports CSV, TSV, RDS, Excel (.xlsx, .xls), Stata (.dta), SPSS (.sav, .zsav, .por), and SAS (.sas7bdat, .xpt) file formats.
data_read(path, delim = NULL, keep_attributes = FALSE, ...)data_read(path, delim = NULL, keep_attributes = FALSE, ...)
path |
Dot notation path (e.g. "source.private.example") or direct file path |
delim |
Optional delimiter for CSV files ("comma", "tab", "semicolon", "space") |
keep_attributes |
Logical flag to preserve special attributes (e.g., haven labels). Default: FALSE (strips attributes) |
... |
Additional arguments passed to read functions (readr::read_delim, readxl::read_excel, haven::read_*, etc.) |
The loaded data, typically a data frame or tibble.
Save data using dot notation or file path
data_save( data, path, type = NULL, delimiter = "comma", locked = TRUE, force = FALSE )data_save( data, path, type = NULL, delimiter = "comma", locked = TRUE, force = FALSE )
data |
Data frame to save |
path |
Either:
Dot notation uses your configured directories
(e.g., |
type |
Type of data file ("csv" or "rds"). Auto-detected from extension if path includes one. |
delimiter |
Delimiter for CSV files ("comma", "tab", "semicolon", "space") |
locked |
Whether the file should be locked after saving |
force |
If TRUE, creates missing directories. If FALSE (default), errors if directory doesn't exist. |
Invisibly returns the saved data.
Gets a database connection based on the connection name in config.yml.
For most use cases, prefer db_query() or db_execute() which handle
connection lifecycle automatically.
db_connect(name)db_connect(name)
name |
Character. Name of the connection in config.yml (e.g., "postgres") |
A database connection object (DBIConnection)
if (FALSE) { # Preferred: use db_query() which auto-disconnects users <- db_query("SELECT * FROM users", "postgres") # Manual connection management (remember to disconnect!) conn <- db_connect("postgres") DBI::dbListTables(conn) DBI::dbDisconnect(conn) }if (FALSE) { # Preferred: use db_query() which auto-disconnects users <- db_query("SELECT * FROM users", "postgres") # Manual connection management (remember to disconnect!) conn <- db_connect("postgres") DBI::dbListTables(conn) DBI::dbDisconnect(conn) }
Interactive helper to install one or more database drivers. Provides helpful instructions and handles special cases (like ODBC).
db_drivers_install(drivers = NULL, repos = getOption("repos"))db_drivers_install(drivers = NULL, repos = getOption("repos"))
drivers |
Character vector. Database driver names to install (e.g., "postgres", "mysql", "duckdb"). If NULL, shows interactive menu. |
repos |
Character. CRAN repository URL. Default: getOption("repos") |
NULL (invisible). Installs packages as side effect.
if (FALSE) { # Install specific drivers db_drivers_install(c("postgres", "mysql")) # Interactive mode db_drivers_install() }if (FALSE) { # Install specific drivers db_drivers_install(c("postgres", "mysql")) # Interactive mode db_drivers_install() }
Checks which database drivers are currently available on the system. Returns a data frame showing the status of all supported database drivers.
db_drivers_status(quiet = FALSE)db_drivers_status(quiet = FALSE)
quiet |
Logical. If TRUE, suppresses messages. Default: FALSE |
A data frame with columns:
driver: Database driver name
package: Required R package
installed: Whether the package is installed
version: Package version (if installed)
# Check all drivers db_drivers_status() # Quiet mode (no messages) db_drivers_status(quiet = TRUE)# Check all drivers db_drivers_status() # Quiet mode (no messages) db_drivers_status(quiet = TRUE)
Executes a SQL statement on a database without returning results. The connection is created, used, and automatically closed.
db_execute(query, connection_name, ...)db_execute(query, connection_name, ...)
query |
SQL statement to execute |
connection_name |
Name of the connection in config.yml |
... |
Additional arguments passed to DBI::dbExecute |
Number of rows affected
if (FALSE) { rows <- db_execute("DELETE FROM cache WHERE expired = TRUE", "my_db") }if (FALSE) { rows <- db_execute("DELETE FROM cache WHERE expired = TRUE", "my_db") }
Lists all database connections defined in the configuration, showing the connection name, driver, host, and database name (if applicable).
db_list()db_list()
Invisibly returns NULL after printing connection list
if (FALSE) { # List all connections db_list() }if (FALSE) { # List all connections db_list() }
Gets data from a database using a query and connection name. The connection is created, used, and automatically closed.
db_query(query, connection_name, ...)db_query(query, connection_name, ...)
query |
SQL query to execute |
connection_name |
Name of the connection in config.yml |
... |
Additional arguments passed to DBI::dbGetQuery |
A data frame with the query results
if (FALSE) { users <- db_query("SELECT * FROM users", "my_db") }if (FALSE) { users <- db_query("SELECT * FROM users", "my_db") }
Wraps code execution in a database transaction with automatic commit on success and rollback on error. This ensures atomicity of multiple database operations.
db_transaction(conn, code)db_transaction(conn, code)
conn |
Database connection |
code |
Expression or code block to execute within the transaction |
The function automatically:
Begins a transaction with DBI::dbBegin()
Executes the provided code
Commits the transaction on success with DBI::dbCommit()
Rolls back the transaction on error with DBI::dbRollback()
Transactions are essential for maintaining data integrity when performing multiple related operations. If any operation fails, all changes are rolled back.
The result of the code expression
if (FALSE) { conn <- db_connect("postgres") # Basic transaction db_transaction(conn, { DBI::dbExecute(conn, "INSERT INTO users (name, age) VALUES ('Alice', 30)") DBI::dbExecute(conn, "INSERT INTO users (name, age) VALUES ('Bob', 25)") }) # Transaction with error handling - auto-rollback on error tryCatch({ db_transaction(conn, { DBI::dbExecute(conn, "INSERT INTO users (name) VALUES ('Alice')") stop("Something went wrong") # This will trigger rollback }) }, error = function(e) { message("Transaction failed: ", e$message) }) DBI::dbDisconnect(conn) }if (FALSE) { conn <- db_connect("postgres") # Basic transaction db_transaction(conn, { DBI::dbExecute(conn, "INSERT INTO users (name, age) VALUES ('Alice', 30)") DBI::dbExecute(conn, "INSERT INTO users (name, age) VALUES ('Bob', 25)") }) # Transaction with error handling - auto-rollback on error tryCatch({ db_transaction(conn, { DBI::dbExecute(conn, "INSERT INTO users (name) VALUES ('Alice')") stop("Something went wrong") # This will trigger rollback }) }, error = function(e) { message("Transaction failed: ", e$message) }) DBI::dbDisconnect(conn) }
Provides automatic connection lifecycle management. The connection is automatically closed when the code block finishes, even if an error occurs. This prevents connection leaks and ensures proper resource cleanup.
db_with(connection_name, code)db_with(connection_name, code)
connection_name |
Character. Name of the connection in config.yml |
code |
Expression to evaluate with the connection (use |
The result of evaluating code
if (FALSE) { # Safe - connection auto-closes users <- db_with("my_db", { DBI::dbGetQuery(conn, "SELECT * FROM users WHERE active = TRUE") }) # Multiple operations with same connection result <- db_with("my_db", { DBI::dbExecute(conn, "INSERT INTO users (name) VALUES ('Alice')") DBI::dbGetQuery(conn, "SELECT * FROM users") }) # Connection closes even on error tryCatch( db_with("my_db", { stop("Something went wrong") # Connection still closes }), error = function(e) message(e$message) ) }if (FALSE) { # Safe - connection auto-closes users <- db_with("my_db", { DBI::dbGetQuery(conn, "SELECT * FROM users WHERE active = TRUE") }) # Multiple operations with same connection result <- db_with("my_db", { DBI::dbExecute(conn, "INSERT INTO users (name) VALUES ('Alice')") DBI::dbGetQuery(conn, "SELECT * FROM users") }) # Connection closes even on error tryCatch( db_with("my_db", { stop("Something went wrong") # Connection still closes }), error = function(e) message(e$message) ) }
Parses roxygen2-generated .Rd files and exports structured documentation to SQLite (for GUI) or other formats. This enables searchable documentation in the Framework GUI and powers the public documentation website.
docs_export( output_path = "docs.db", man_dir = "man", package_name = "framework", package_version = NULL, include_internal = FALSE, verbose = TRUE )docs_export( output_path = "docs.db", man_dir = "man", package_name = "framework", package_version = NULL, include_internal = FALSE, verbose = TRUE )
output_path |
Path to SQLite database file. Default: "docs.db" |
man_dir |
Directory containing .Rd files. Default: "man" |
package_name |
Package name for metadata. Default: "framework" |
package_version |
Package version for metadata. Default: NULL (auto-detect) |
include_internal |
Include internal/non-exported functions. Default: FALSE |
verbose |
Print progress messages. Default: TRUE |
The exporter reads all .Rd files from the man/ directory and extracts:
Function name, title, description, details
Arguments/parameters with descriptions
Usage signatures
Examples (with dontrun detection)
See Also references
Custom sections and subsections
Keywords
The SQLite output includes FTS5 full-text search for fast querying.
Invisibly returns the database connection path
if (FALSE) { # Export to default location (exported functions only) docs_export() # Export to custom location docs_export("inst/gui/docs.db") # Include internal/private functions too docs_export("all_docs.db", include_internal = TRUE) # Query the exported docs con <- DBI::dbConnect(RSQLite::SQLite(), "docs.db") DBI::dbGetQuery(con, "SELECT name, title FROM functions WHERE name LIKE 'data_%'") DBI::dbDisconnect(con) }if (FALSE) { # Export to default location (exported functions only) docs_export() # Export to custom location docs_export("inst/gui/docs.db") # Include internal/private functions too docs_export("all_docs.db", include_internal = TRUE) # Query the exported docs con <- DBI::dbConnect(RSQLite::SQLite(), "docs.db") DBI::dbGetQuery(con, "SELECT name, title FROM functions WHERE name LIKE 'data_%'") DBI::dbDisconnect(con) }
Cleans up the R environment by removing objects, closing plots, detaching packages, and running garbage collection. Does not clear the console.
env_clear(keep = character(), envir)env_clear(keep = character(), envir)
keep |
Character vector of object names to keep (default: empty) |
envir |
The environment to clear |
Invisibly returns NULL
if (FALSE) { # Clean a specific environment env_clear(envir = my_env) # Keep specific objects env_clear(keep = c("config", "data"), envir = my_env) }if (FALSE) { # Clean a specific environment env_clear(envir = my_env) # Keep specific objects env_clear(keep = c("config", "data"), envir = my_env) }
Displays a summary of the current R environment including loaded packages, objects in the global environment, and memory usage.
env_summary(envir)env_summary(envir)
envir |
The environment to summarize |
Invisibly returns a list with environment information
if (FALSE) { env_summary(envir = my_env) }if (FALSE) { env_summary(envir = my_env) }
Returns the path to Framework's global configuration directory.
Uses tools::R_user_dir("framework", "config") by default (CRAN compliant).
Can be overridden with the FW_CONFIG_HOME environment variable.
fw_config_dir()fw_config_dir()
Character string with the config directory path
Add file contents to the staging area.
git_add(files = ".")git_add(files = ".")
files |
Character vector of file paths to stage, or "." for all (default) |
Invisibly returns TRUE on success
if (FALSE) { git_add() # Stage all changes git_add("README.md") # Stage specific file git_add(c("R/foo.R", "R/bar.R")) }if (FALSE) { git_add() # Stage all changes git_add("README.md") # Stage specific file git_add(c("R/foo.R", "R/bar.R")) }
Record changes to the repository with a commit message.
git_commit(message, all = FALSE)git_commit(message, all = FALSE)
message |
Commit message (required) |
all |
Logical; if TRUE, automatically stage modified/deleted files (default: FALSE) |
Invisibly returns TRUE on success
if (FALSE) { git_commit("Fix bug in data loading") git_commit("Update README", all = TRUE) # Stage and commit }if (FALSE) { git_commit("Fix bug in data loading") git_commit("Update README", all = TRUE) # Stage and commit }
Show changes between commits, working tree, etc.
git_diff(staged = FALSE, file = NULL)git_diff(staged = FALSE, file = NULL)
staged |
Logical; if TRUE, show staged changes (default: FALSE shows unstaged) |
file |
Optional file path to show diff for specific file |
Invisibly returns the diff output as a character vector
if (FALSE) { git_diff() # Show unstaged changes git_diff(staged = TRUE) # Show staged changes git_diff(file = "R/foo.R") }if (FALSE) { git_diff() # Show unstaged changes git_diff(staged = TRUE) # Show staged changes git_diff(file = "R/foo.R") }
Disables a specific hook in settings and reinstalls the pre-commit hook.
git_hooks_disable(hook_name, config_file = NULL, verbose = TRUE)git_hooks_disable(hook_name, config_file = NULL, verbose = TRUE)
hook_name |
Name of hook: "ai_sync", "data_security", or "check_sensitive_dirs" |
config_file |
Path to configuration file (default: auto-discover settings.yml or settings.yml) |
verbose |
Logical; if TRUE (default), show messages |
Invisible TRUE on success
Enables a specific hook in settings and reinstalls the pre-commit hook.
git_hooks_enable(hook_name, config_file = NULL, verbose = TRUE)git_hooks_enable(hook_name, config_file = NULL, verbose = TRUE)
hook_name |
Name of hook: "ai_sync", "data_security", or "check_sensitive_dirs" |
config_file |
Path to configuration file (default: auto-discover settings.yml or settings.yml) |
verbose |
Logical; if TRUE (default), show messages |
Invisible TRUE on success
if (FALSE) { git_hooks_enable("ai_sync") git_hooks_enable("data_security") }if (FALSE) { git_hooks_enable("ai_sync") git_hooks_enable("data_security") }
Creates a pre-commit hook that runs Framework checks based on settings.yml settings.
git_hooks_install(config_file = NULL, force = FALSE, verbose = TRUE)git_hooks_install(config_file = NULL, force = FALSE, verbose = TRUE)
config_file |
Path to configuration file (default: "settings.yml") |
force |
Logical; if TRUE, overwrite existing hook (default: FALSE) |
verbose |
Logical; if TRUE (default), show installation messages |
Creates or updates .git/hooks/pre-commit to run enabled Framework hooks:
ai_sync: Sync AI assistant context files before commit
data_security: Run security audit to catch data leaks
check_sensitive_dirs: Warn about unignored sensitive directories
Hook behavior is controlled by git.hooks.* settings in settings.yml.
Invisible TRUE on success, FALSE on failure
if (FALSE) { # Install hooks based on settings.yml git_hooks_install() # Force reinstall (overwrites existing hook) git_hooks_install(force = TRUE) }if (FALSE) { # Install hooks based on settings.yml git_hooks_install() # Force reinstall (overwrites existing hook) git_hooks_install(force = TRUE) }
Shows which hooks are enabled and their current status.
git_hooks_list(config_file = NULL)git_hooks_list(config_file = NULL)
config_file |
Path to configuration file (default: auto-discover settings.yml or settings.yml) |
Data frame with hook information
Removes the Framework-managed pre-commit hook.
git_hooks_uninstall(verbose = TRUE)git_hooks_uninstall(verbose = TRUE)
verbose |
Logical; if TRUE (default), show messages |
Invisible TRUE if hook was removed, FALSE otherwise
Show recent commit history.
git_log(n = 10, oneline = TRUE)git_log(n = 10, oneline = TRUE)
n |
Number of commits to show (default: 10) |
oneline |
Logical; if TRUE, show condensed one-line format (default: TRUE) |
Invisibly returns the log output as a character vector
if (FALSE) { git_log() git_log(n = 5) git_log(oneline = FALSE) # Full format }if (FALSE) { git_log() git_log(n = 5) git_log(oneline = FALSE) # Full format }
Fetch and integrate changes from the remote repository.
git_pull(remote = "origin", branch = NULL)git_pull(remote = "origin", branch = NULL)
remote |
Remote name (default: "origin") |
branch |
Branch name (default: current branch) |
Invisibly returns TRUE on success
if (FALSE) { git_pull() git_pull(remote = "origin", branch = "main") }if (FALSE) { git_pull() git_pull(remote = "origin", branch = "main") }
Push commits to the remote repository.
git_push(remote = "origin", branch = NULL)git_push(remote = "origin", branch = NULL)
remote |
Remote name (default: "origin") |
branch |
Branch name (default: current branch) |
Invisibly returns TRUE on success
if (FALSE) { git_push() git_push(remote = "origin", branch = "main") }if (FALSE) { git_push() git_push(remote = "origin", branch = "main") }
Performs a comprehensive security audit of data files in Framework projects, checking for unignored data files, git history leaks, and orphaned data files outside configured directories.
git_security_audit( config_file = NULL, check_git_history = TRUE, history_depth = "all", auto_fix = FALSE, verbose = TRUE, extensions = c("csv", "rds", "tsv", "txt", "dat", "xlsx", "xls", "sqlite", "db", "dta", "sav", "zsav", "por", "sas7bdat", "sas7bcat", "xpt", "parquet", "feather", "arrow", "json", "xml", "h5", "hdf5") )git_security_audit( config_file = NULL, check_git_history = TRUE, history_depth = "all", auto_fix = FALSE, verbose = TRUE, extensions = c("csv", "rds", "tsv", "txt", "dat", "xlsx", "xls", "sqlite", "db", "dta", "sav", "zsav", "por", "sas7bdat", "sas7bcat", "xpt", "parquet", "feather", "arrow", "json", "xml", "h5", "hdf5") )
config_file |
Path to configuration file (default: auto-detect settings.yml/settings.yml) |
check_git_history |
Logical; if TRUE (default), check git history for leaked data files |
history_depth |
Character or numeric. "all" for full history, "shallow" for recent 100 commits, or numeric for specific commit count (default: "all") |
auto_fix |
Logical; if TRUE, automatically update .gitignore (default: FALSE) |
verbose |
Logical; if TRUE (default), show progress messages |
extensions |
Character vector of data file extensions to detect (default: common data formats) |
The security audit performs the following checks:
gitignore_coverage: Verifies all private data files are in .gitignore
git_history: Scans git history for accidentally committed data files
orphaned_files: Finds data files outside configured directories
private_data_exposure: Checks if private data is tracked by git
Status levels:
pass: No issues found
warning: Potential issues that should be reviewed
fail: Critical security issues requiring immediate action
A structured list containing:
Data frame with check names, status (pass/warning/fail), and counts
List of data frames with detailed findings for each check
Character vector of actionable recommendations
List with audit timestamp, Framework version, and config info
if (FALSE) { # Basic audit (report only) audit <- git_security_audit() print(audit$summary) View(audit$findings$orphaned_files) # Quick scan without git history audit <- git_security_audit(check_git_history = FALSE) # Verbose with limited git history audit <- git_security_audit(history_depth = 100, verbose = TRUE) # Auto-fix mode (updates .gitignore) audit <- git_security_audit(auto_fix = TRUE) }if (FALSE) { # Basic audit (report only) audit <- git_security_audit() print(audit$summary) View(audit$findings$orphaned_files) # Quick scan without git history audit <- git_security_audit(check_git_history = FALSE) # Verbose with limited git history audit <- git_security_audit(history_depth = 100, verbose = TRUE) # Auto-fix mode (updates .gitignore) audit <- git_security_audit(auto_fix = TRUE) }
Display the working tree status from the R console.
git_status(short = FALSE)git_status(short = FALSE)
short |
Logical; if TRUE, show short format (default: FALSE) |
Invisibly returns the status output as a character vector
if (FALSE) { git_status() git_status(short = TRUE) }if (FALSE) { git_status() git_status(short = TRUE) }
Opens a beautiful web-based interface for Framework with documentation, project management, and settings configuration.
gui(port = 8080, host = "127.0.0.1", browse = TRUE, route = NULL)gui(port = 8080, host = "127.0.0.1", browse = TRUE, route = NULL)
port |
Port number to use (default: 8080) |
host |
Host address to bind to. Default "127.0.0.1" for local access only. Use "0.0.0.0" to allow connections from other machines (requires appropriate network security). |
browse |
Automatically open browser (default: TRUE) |
route |
Initial route to open (default: NULL for home page) |
Invisibly returns the plumber server object
setup() for first-time configuration
if (FALSE) { # Launch the GUI framework::gui() # Launch on specific port framework::gui(port = 8888) # Open directly to settings framework::gui(route = "#/settings/basics") # Run as standalone server (no browser, accessible from network) framework::gui(port = 8080, host = "0.0.0.0", browse = FALSE) }if (FALSE) { # Launch the GUI framework::gui() # Launch on specific port framework::gui(port = 8888) # Open directly to settings framework::gui(route = "#/settings/basics") # Run as standalone server (no browser, accessible from network) framework::gui(port = 8080, host = "0.0.0.0", browse = FALSE) }
The catalog defines metadata (labels, hints) and default values for settings
sections. Users can override the packaged defaults by placing a
settings-catalog.yml file in their Framework config directory
(tools::R_user_dir("framework", "config")). When an override exists it is
merged on top of the packaged catalog.
load_settings_catalog(include_user = TRUE, validate = TRUE)load_settings_catalog(include_user = TRUE, validate = TRUE)
include_user |
Logical indicating whether to merge user overrides.
Defaults to |
validate |
Logical indicating whether to perform basic validation on
the catalog structure. Defaults to |
A nested list representing the settings catalog.
Creates a new Quarto (.qmd), RMarkdown (.Rmd) notebook, or R script (.R)
from stub templates. Searches for user-provided stubs first (in stubs/
directory), then falls back to framework defaults.
make_notebook( name, type = NULL, dir = NULL, stub = "default", overwrite = FALSE, subdir = NULL )make_notebook( name, type = NULL, dir = NULL, stub = "default", overwrite = FALSE, subdir = NULL )
name |
Character. The file name. Extension determines type:
|
type |
Character. File type: "quarto", "rmarkdown", or "script". Auto-detected from extension if provided. If NULL (default):
|
dir |
Character. Directory to create the file in. Uses your project's
configured |
stub |
Character. Name of the stub template to use. Defaults to
"default". User can create custom stubs in |
overwrite |
Logical. Whether to overwrite existing file. Default FALSE. |
subdir |
Optional subdirectory under |
Convenient aliases: Use make_qmd() or make_rmd() for explicit
Quarto or RMarkdown notebook creation. Use make_revealjs() or
make_presentation() for reveal.js presentations.
Notebooks are created in the notebooks/ directory by default:
notebooks/ 1-data-cleaning.qmd 2-analysis.qmd 3-visualization.qmd
If name includes .qmd or .Rmd, type is auto-detected
If no extension provided, .qmd is used (Quarto-first)
Use type = "rmarkdown" to default to .Rmd
The function searches for stub templates in this order:
User stubs: stubs/notebook-{stub}.qmd or stubs/notebook-{stub}.Rmd
Framework stubs: inst/stubs/notebook-{stub}.qmd or inst/stubs/notebook-{stub}.Rmd
Custom stub templates can use placeholders:
{filename} - The notebook filename without extension
{date} - Current date (YYYY-MM-DD)
Invisible path to created notebook
make_qmd(), make_rmd(), make_revealjs(), make_presentation()
if (FALSE) { # Create notebooks/1-init.qmd (defaults to Quarto) make_notebook("1-init") # Create notebooks/analysis.Rmd (RMarkdown, extension-based) make_notebook("analysis.Rmd") # Explicit type parameter make_notebook("report", type = "rmarkdown") # Use custom stub template make_notebook("report", stub = "minimal") # Create in specific directory make_notebook("explore", dir = "work") # Convenient aliases (recommended for explicit types) make_qmd("analysis") # Always creates .qmd make_rmd("report") # Always creates .Rmd make_revealjs("slides") # Creates reveal.js presentation make_presentation("deck") # Alias for make_revealjs() }if (FALSE) { # Create notebooks/1-init.qmd (defaults to Quarto) make_notebook("1-init") # Create notebooks/analysis.Rmd (RMarkdown, extension-based) make_notebook("analysis.Rmd") # Explicit type parameter make_notebook("report", type = "rmarkdown") # Use custom stub template make_notebook("report", stub = "minimal") # Create in specific directory make_notebook("explore", dir = "work") # Convenient aliases (recommended for explicit types) make_qmd("analysis") # Always creates .qmd make_rmd("report") # Always creates .Rmd make_revealjs("slides") # Creates reveal.js presentation make_presentation("deck") # Alias for make_revealjs() }
Alias for make_revealjs(). Creates a Quarto reveal.js presentation.
make_presentation(name, dir = NULL, overwrite = FALSE, subdir = NULL)make_presentation(name, dir = NULL, overwrite = FALSE, subdir = NULL)
name |
Character. The presentation name (with or without .qmd extension) |
dir |
Character. Directory to create the file in. Uses your project's
configured |
overwrite |
Logical. Whether to overwrite existing file. Default FALSE. |
subdir |
Optional subdirectory under |
Invisible path to created presentation
make_notebook(), make_revealjs()
if (FALSE) { # Create notebooks/deck.qmd with reveal.js format make_presentation("deck") }if (FALSE) { # Create notebooks/deck.qmd with reveal.js format make_presentation("deck") }
Convenient alias for make_notebook(type = "quarto"). Creates a .qmd file
from stub templates.
make_qmd(name, dir = NULL, stub = "default", overwrite = FALSE, subdir = NULL)make_qmd(name, dir = NULL, stub = "default", overwrite = FALSE, subdir = NULL)
name |
Character. The file name (with or without .qmd extension) |
dir |
Character. Directory to create the file in. Uses your project's
configured |
stub |
Character. Name of the stub template to use. Default "default". |
overwrite |
Logical. Whether to overwrite existing file. Default FALSE. |
subdir |
Optional subdirectory under |
Invisible path to created notebook
if (FALSE) { # Create notebooks/analysis.qmd make_qmd("analysis") # Use custom stub make_qmd("report", stub = "minimal") # Create in specific directory make_qmd("explore", dir = "work") }if (FALSE) { # Create notebooks/analysis.qmd make_qmd("analysis") # Use custom stub make_qmd("report", stub = "minimal") # Create in specific directory make_qmd("explore", dir = "work") }
Convenient alias for creating reveal.js presentations. Always creates a Quarto notebook with the revealjs stub template.
make_revealjs(name, dir = NULL, overwrite = FALSE, subdir = NULL)make_revealjs(name, dir = NULL, overwrite = FALSE, subdir = NULL)
name |
Character. The presentation name (with or without .qmd extension) |
dir |
Character. Directory to create the file in. Uses your project's
configured |
overwrite |
Logical. Whether to overwrite existing file. Default FALSE. |
subdir |
Optional subdirectory under |
Invisible path to created presentation
make_notebook(), make_qmd(), make_presentation()
if (FALSE) { # Create notebooks/slides.qmd with reveal.js format make_revealjs("slides") # Create in specific directory make_revealjs("presentation", dir = "presentations") }if (FALSE) { # Create notebooks/slides.qmd with reveal.js format make_revealjs("slides") # Create in specific directory make_revealjs("presentation", dir = "presentations") }
Convenient alias for make_notebook(type = "rmarkdown"). Creates a .Rmd file
from stub templates.
make_rmd(name, dir = NULL, stub = "default", overwrite = FALSE, subdir = NULL)make_rmd(name, dir = NULL, stub = "default", overwrite = FALSE, subdir = NULL)
name |
Character. The file name (with or without .Rmd extension) |
dir |
Character. Directory to create the file in. Uses your project's
configured |
stub |
Character. Name of the stub template to use. Default "default". |
overwrite |
Logical. Whether to overwrite existing file. Default FALSE. |
subdir |
Optional subdirectory under |
Invisible path to created notebook
if (FALSE) { # Create notebooks/analysis.Rmd make_rmd("analysis") # Use custom stub make_rmd("report", stub = "minimal") # Create in specific directory make_rmd("explore", dir = "work") }if (FALSE) { # Create notebooks/analysis.Rmd make_rmd("analysis") # Use custom stub make_rmd("report", stub = "minimal") # Create in specific directory make_rmd("explore", dir = "work") }
Convenience wrapper for make_notebook() that creates R scripts (.R files).
This is identical to calling make_notebook("name.R").
make_script(name, dir = NULL, stub = "default", overwrite = FALSE)make_script(name, dir = NULL, stub = "default", overwrite = FALSE)
name |
Character. The script name (with or without .R extension). Examples: "process-data", "process-data.R" |
dir |
Character. Directory to create the script in. Uses your project's
configured |
stub |
Character. Name of the stub template to use. Defaults to
"default". User can create custom stubs in |
overwrite |
Logical. Whether to overwrite existing file. Default FALSE. |
This function is a convenience wrapper that:
Ensures the name ends with .R extension
Uses script_dir config option instead of notebook_dir
Calls make_notebook() with type = "script"
Scripts are created in the scripts/ directory by default:
scripts/ process-data.R build-features.R run-model.R
Invisible path to created script
make_notebook() for creating Quarto/RMarkdown notebooks
if (FALSE) { # Create script (extension optional) make_script("process-data") make_script("process-data.R") # Use custom stub make_script("etl-pipeline", stub = "etl") # Create in specific directory make_script("analysis", dir = "analysis/") }if (FALSE) { # Create script (extension optional) make_script("process-data") make_script("process-data.R") # Use custom stub make_script("etl-pipeline", stub = "etl") # Create in specific directory make_script("analysis", dir = "analysis/") }
Flexible project creation interface. Alias for new_project() that accepts
type as a parameter.
new( name = NULL, location = NULL, type = "project", browse = interactive(), ... )new( name = NULL, location = NULL, type = "project", browse = interactive(), ... )
name |
Project name. If NULL (default), prompts interactively. |
location |
Directory path where project will be created. If NULL (default), prompts interactively. |
type |
Project type. One of "project" (default), "project_sensitive", "course", or "presentation". |
browse |
Whether to open the project folder after creation (default: TRUE in interactive sessions) |
... |
Additional arguments passed to 'project_ |
Invisibly returns the result from project_create()
new_project(), new_project_sensitive(), new_presentation(), new_course()
if (FALSE) { # Create different project types new("analysis", "~/projects/analysis") new("study", "~/projects/study", type = "project_sensitive") new("slides", "~/projects/slides", type = "presentation") new("course-materials", "~/projects/course", type = "course") }if (FALSE) { # Create different project types new("analysis", "~/projects/analysis") new("study", "~/projects/study", type = "project_sensitive") new("slides", "~/projects/slides", type = "presentation") new("course-materials", "~/projects/course", type = "course") }
Shorthand for new_project(..., type = "course"). Creates a project
structured for teaching materials with slides, assignments, and modules.
new_course(name = NULL, location = NULL, browse = interactive(), ...)new_course(name = NULL, location = NULL, browse = interactive(), ...)
name |
Project name. If NULL (default), prompts interactively. |
location |
Directory path where project will be created. If NULL (default), prompts interactively. |
browse |
Whether to open the project folder after creation (default: TRUE in interactive sessions) |
... |
Additional arguments passed to 'project_ |
Invisibly returns the result from project_create()
if (FALSE) { new_course("stats-101", "~/projects/stats-101") }if (FALSE) { new_course("stats-101", "~/projects/stats-101") }
Shorthand for new_project(..., type = "presentation"). Creates a project
optimized for RevealJS presentations.
new_presentation(name = NULL, location = NULL, browse = interactive(), ...)new_presentation(name = NULL, location = NULL, browse = interactive(), ...)
name |
Project name. If NULL (default), prompts interactively. |
location |
Directory path where project will be created. If NULL (default), prompts interactively. |
browse |
Whether to open the project folder after creation (default: TRUE in interactive sessions) |
... |
Additional arguments passed to 'project_ |
Invisibly returns the result from project_create()
if (FALSE) { new_presentation("quarterly-review", "~/projects/q4-review") }if (FALSE) { new_presentation("quarterly-review", "~/projects/q4-review") }
Convenience wrapper for creating Framework projects from the command line.
Uses global settings configured via setup() as defaults, prompts for
missing required values (name and location).
new_project( name = NULL, location = NULL, type = "project", browse = interactive(), ... )new_project( name = NULL, location = NULL, type = "project", browse = interactive(), ... )
name |
Project name. If NULL (default), prompts interactively. |
location |
Directory path where project will be created. If NULL (default), prompts interactively. |
type |
Project type. One of "project" (default), "project_sensitive", "course", or "presentation". |
browse |
Whether to open the project folder after creation (default: TRUE in interactive sessions) |
... |
Additional arguments passed to 'project_ |
This function is designed for the streamlined workflow:
remotes::install_github("table1/framework")
framework::setup() # One-time global configuration
framework::new_project() # Create projects using saved defaults
Global settings from tools::R_user_dir("framework", "config") are used for:
Author information (name, email, affiliation
Default packages
Directory structure
Git settings
AI assistant configuration
Quarto format preferences
Invisibly returns the result from project_create() (list with success,
path, and project_id)
setup() for initial configuration, project_create() for full control
if (FALSE) { # Interactive - prompts for name and location new_project() # With name and location specified new_project("my-analysis", "~/projects/my-analysis") # Create a sensitive data project new_project("medical-study", "~/projects/medical", type = "project_sensitive") }if (FALSE) { # Interactive - prompts for name and location new_project() # With name and location specified new_project("my-analysis", "~/projects/my-analysis") # Create a sensitive data project new_project("medical-study", "~/projects/medical", type = "project_sensitive") }
Shorthand for new_project(..., type = "project_sensitive"). Creates a project
with additional privacy protections for handling sensitive data.
new_project_sensitive( name = NULL, location = NULL, browse = interactive(), ... )new_project_sensitive( name = NULL, location = NULL, browse = interactive(), ... )
name |
Project name. If NULL (default), prompts interactively. |
location |
Directory path where project will be created. If NULL (default), prompts interactively. |
browse |
Whether to open the project folder after creation (default: TRUE in interactive sessions) |
... |
Additional arguments passed to 'project_ |
Invisibly returns the result from project_create()
if (FALSE) { new_project_sensitive("medical-study", "~/projects/medical") }if (FALSE) { new_project_sensitive("medical-study", "~/projects/medical") }
Get current datetime
now()now()
Current datetime as an ISO 8601 formatted character string
First-class functions for saving tables, figures, models, and reports. These functions implement lazy directory creation with console feedback.
Installs all packages defined in the configuration that are not already installed. This is the same logic used in scaffold(), but exposed as a standalone function.
packages_install()packages_install()
Invisibly returns TRUE on success
if (FALSE) { # Install all configured packages packages_install() }if (FALSE) { # Install all configured packages packages_install() }
Lists all packages defined in the configuration, showing the package name, version pin (if specified), and source (CRAN or GitHub).
packages_list()packages_list()
Invisibly returns NULL after printing package list
if (FALSE) { # List all packages packages_list() }if (FALSE) { # List all packages packages_list() }
Wrapper around renv::restore() that requires Framework's renv integration
to be enabled first.
packages_restore(prompt = FALSE)packages_restore(prompt = FALSE)
prompt |
Logical. If TRUE, renv prompts before restoring. |
Invisibly returns TRUE on success.
Wrapper around renv::snapshot() that requires Framework's renv integration
to be enabled first.
packages_snapshot(prompt = FALSE)packages_snapshot(prompt = FALSE)
prompt |
Logical. If TRUE, renv prompts before writing the snapshot. |
Invisibly returns TRUE on success.
Wrapper around renv::status() that requires Framework's renv integration.
packages_status()packages_status()
The status object returned by renv::status().
Updates packages defined in the configuration. If renv is enabled, uses renv::update(). Otherwise, reinstalls packages using standard installation methods.
packages_update(packages = NULL)packages_update(packages = NULL)
packages |
Character vector of specific packages to update, or NULL to update all |
Invisibly returns TRUE on success
if (FALSE) { # Update all packages packages_update() # Update specific packages packages_update(c("dplyr", "ggplot2")) }if (FALSE) { # Update all packages packages_update() # Update specific packages packages_update(c("dplyr", "ggplot2")) }
Shows configured directories and their status (created or pending lazy creation). Useful for understanding the project structure and discovering available paths.
project_info(verbose = FALSE)project_info(verbose = FALSE)
verbose |
If TRUE, shows additional details about each directory |
A data frame with directory information (invisibly)
if (FALSE) { # Show project structure project_info() # Get detailed info project_info(verbose = TRUE) }if (FALSE) { # Show project structure project_info() # Get detailed info project_info(verbose = TRUE) }
List all projects in global configuration
project_list()project_list()
Data frame with project information
Functions for publishing notebooks, data, and files to S3 storage.
Upload files or directories to an S3 bucket. This is the generic publishing
function - use publish_notebook() for Quarto documents or publish_data()
for data files.
publish(source, dest = NULL, connection = NULL, overwrite = TRUE)publish(source, dest = NULL, connection = NULL, overwrite = TRUE)
source |
Character. Local file or directory path to upload. |
dest |
Character or NULL. Destination path in S3 bucket. If NULL, derives from source filename. |
connection |
Character or NULL. S3 connection name from config.yml.
If NULL, uses the connection marked with |
overwrite |
Logical. Whether to overwrite existing files. Default TRUE. |
Character. The public URL(s) of uploaded file(s).
if (FALSE) { # Upload a single file publish("outputs/report.html") # -> https://bucket.s3.region.amazonaws.com/prefix/report.html # Upload with custom destination publish("outputs/report.html", dest = "reports/q4-2024.html") # Upload a directory publish("outputs/charts/", dest = "reports/charts/") # Use specific connection publish("data.csv", connection = "s3_backup") }if (FALSE) { # Upload a single file publish("outputs/report.html") # -> https://bucket.s3.region.amazonaws.com/prefix/report.html # Upload with custom destination publish("outputs/report.html", dest = "reports/q4-2024.html") # Upload a directory publish("outputs/charts/", dest = "reports/charts/") # Use specific connection publish("data.csv", connection = "s3_backup") }
Uploads a data frame or existing data file to S3.
publish_data(data, dest, format = "csv", connection = NULL, compress = FALSE)publish_data(data, dest, format = "csv", connection = NULL, compress = FALSE)
data |
Data frame or character path to existing file. |
dest |
Character. Destination path in S3 (required for data frames). |
format |
Character. Output format when |
connection |
Character or NULL. S3 connection name, or NULL for default. |
compress |
Logical. Whether to gzip compress. Default FALSE. |
Character. Public URL of the published data.
if (FALSE) { # Publish a data frame publish_data(my_df, "datasets/customers.csv") # Publish as RDS publish_data(my_df, "datasets/customers.rds", format = "rds") # Publish existing file publish_data("outputs/model.rds", "models/v2/model.rds") }if (FALSE) { # Publish a data frame publish_data(my_df, "datasets/customers.csv") # Publish as RDS publish_data(my_df, "datasets/customers.rds", format = "rds") # Publish existing file publish_data("outputs/model.rds", "models/v2/model.rds") }
Recursively uploads all files in a directory to S3.
publish_dir( dir, dest = NULL, connection = NULL, pattern = NULL, recursive = TRUE )publish_dir( dir, dest = NULL, connection = NULL, pattern = NULL, recursive = TRUE )
dir |
Character. Local directory path. |
dest |
Character or NULL. Destination prefix in S3. If NULL, uses the directory name. |
connection |
Character or NULL. S3 connection name, or NULL for default. |
pattern |
Character or NULL. Optional regex pattern to filter files. |
recursive |
Logical. Whether to include subdirectories. Default TRUE. |
Character vector. Public URLs of uploaded files.
if (FALSE) { # Upload entire directory publish_dir("outputs/dashboard/") # Upload to specific location publish_dir("outputs/dashboard/", dest = "dashboards/v2/") # Upload only HTML files publish_dir("outputs/", pattern = "\\.html$") }if (FALSE) { # Upload entire directory publish_dir("outputs/dashboard/") # Upload to specific location publish_dir("outputs/dashboard/", dest = "dashboards/v2/") # Upload only HTML files publish_dir("outputs/", pattern = "\\.html$") }
Lists files in an S3 bucket/prefix.
publish_list(prefix = NULL, connection = NULL, max = 1000L)publish_list(prefix = NULL, connection = NULL, max = 1000L)
prefix |
Character or NULL. Prefix to filter by. If NULL, lists all files under the connection's configured prefix. |
connection |
Character or NULL. S3 connection name, or NULL for default. |
max |
Integer. Maximum number of files to list. Default 1000. |
Data frame with columns: key, size, last_modified.
if (FALSE) { # List all published files publish_list() # List files under a prefix publish_list("reports/") # List from specific connection publish_list(connection = "s3_backup") }if (FALSE) { # List all published files publish_list() # List files under a prefix publish_list("reports/") # List from specific connection publish_list(connection = "s3_backup") }
Renders a Quarto document and uploads it to S3. The notebook is rendered to a temporary directory, uploaded, then cleaned up.
publish_notebook( file, dest = NULL, connection = NULL, self_contained = TRUE, format = "html", ... )publish_notebook( file, dest = NULL, connection = NULL, self_contained = TRUE, format = "html", ... )
file |
Character. Path to .qmd file. |
dest |
Character or NULL. Destination path in S3 (without extension). If NULL, derives from filename (e.g., "analysis.qmd" -> "analysis"). |
connection |
Character or NULL. S3 connection name, or NULL for default. |
self_contained |
Logical. Whether to embed all resources. Default TRUE.
Ignored if |
format |
Character. Output format. Default "html". |
... |
Additional arguments passed to quarto render. |
The URL format depends on the S3 connection's static_hosting setting:
static_hosting: true -> uploads to dest/index.html, returns dest/
static_hosting: false (default) -> uploads as dest.html, returns dest.html
Character. Public URL of the published notebook.
if (FALSE) { # With static_hosting: true -> returns /analysis/ # With static_hosting: false -> returns /analysis.html publish_notebook("notebooks/analysis.qmd") # Publish to specific location publish_notebook("notebooks/analysis.qmd", dest = "reports/2024/q4") # Publish non-self-contained (only with static_hosting: true) publish_notebook("notebooks/analysis.qmd", self_contained = FALSE) }if (FALSE) { # With static_hosting: true -> returns /analysis/ # With static_hosting: false -> returns /analysis.html publish_notebook("notebooks/analysis.qmd") # Publish to specific location publish_notebook("notebooks/analysis.qmd", dest = "reports/2024/q4") # Publish non-self-contained (only with static_hosting: true) publish_notebook("notebooks/analysis.qmd", self_contained = FALSE) }
Main entry point for generating all _quarto.yml files in a project.
Generates root config and directory-specific configs based on project type.
quarto_generate_all( project_path, project_type, render_dirs = NULL, quarto_settings = NULL, directories = NULL, root_output_dir = NULL )quarto_generate_all( project_path, project_type, render_dirs = NULL, quarto_settings = NULL, directories = NULL, root_output_dir = NULL )
project_path |
Character. Path to project root |
project_type |
Character. One of "project", "project_sensitive", "course", "presentation" |
render_dirs |
Named list. Render directories with their paths |
quarto_settings |
List. Quarto settings (html and revealjs configs) |
directories |
Named list. Source directories keyed the same as render_dirs |
root_output_dir |
Optional output directory to set on the root _quarto.yml |
List with success status and paths of generated files
Regenerates all _quarto.yml files in a project.
WARNING: This will overwrite any manual edits.
Should only be called when user explicitly requests regeneration.
quarto_regenerate(project_path, backup = TRUE)quarto_regenerate(project_path, backup = TRUE)
project_path |
Character. Path to project root |
backup |
Logical. If TRUE, backs up existing files before overwriting. Default TRUE. |
List with success status, backed up files, and regenerated files
Read the contents of a Framework template
read_framework_template(name)read_framework_template(name)
name |
Template identifier (e.g., "notebook", "gitignore", "ai_claude") |
Character scalar containing template contents
Read global Framework configuration
read_frameworkrc(use_defaults = TRUE)read_frameworkrc(use_defaults = TRUE)
use_defaults |
Whether to merge with default structure (default: TRUE) |
List containing global configuration
Remove project from global configuration
remove_project_from_config(project_id)remove_project_from_config(project_id)
project_id |
Project ID to remove |
Invisibly returns NULL
Deactivates renv integration while preserving renv.lock for future use.
Removes the .framework_renv_enabled marker file.
renv_disable(keep_renv = TRUE)renv_disable(keep_renv = TRUE)
keep_renv |
Logical; if TRUE (default), keep renv.lock and renv/ directory |
Invisibly returns TRUE on success
if (FALSE) { renv_disable() }if (FALSE) { renv_disable() }
Initializes renv integration for the current Framework project. This:
Creates .framework_renv_enabled marker file
Initializes renv if not already initialized
Syncs packages from settings.yml to renv.lock
Updates .gitignore to exclude renv cache
renv_enable(sync = TRUE)renv_enable(sync = TRUE)
sync |
Logical; if TRUE (default), sync packages from settings.yml |
Invisibly returns TRUE on success
if (FALSE) { renv_enable() }if (FALSE) { renv_enable() }
Determines whether renv integration is active by checking for the
.framework_renv_enabled marker file in the project root.
renv_enabled()renv_enabled()
Logical indicating whether renv is enabled
if (renv_enabled()) { message("Using renv for package management") }if (renv_enabled()) { message("Using renv for package management") }
Reset a Framework template back to the packaged default
reset_framework_template(name)reset_framework_template(name)
name |
Template identifier (e.g., "notebook", "gitignore", "ai_claude") |
Invisibly returns the file path of the reset template.
Retrieves a list of all saved results (tables, figures, models, reports, notebooks) that have been tracked via the save_* functions.
result_list(type = NULL, public = NULL)result_list(type = NULL, public = NULL)
type |
Optional filter by type: "table", "figure", "model", "report", "notebook" |
public |
Optional filter: TRUE for public results only, FALSE for private only |
A data frame with columns: name, type, public, comment, hash, created_at, updated_at. Returns an empty data frame if no results found or database unavailable.
if (FALSE) { # List all results result_list() # List only tables result_list(type = "table") # List only public figures result_list(type = "figure", public = TRUE) }if (FALSE) { # List all results result_list() # List only tables result_list(type = "table") # List only public figures result_list(type = "figure", public = TRUE) }
Saves a ggplot2 plot or base R graphics to the configured figures directory. The directory is created lazily on first use.
save_figure( plot = NULL, name, format = "png", width = 8, height = 6, dpi = 300, public = FALSE, overwrite = TRUE, ... )save_figure( plot = NULL, name, format = "png", width = 8, height = 6, dpi = 300, public = FALSE, overwrite = TRUE, ... )
plot |
A ggplot2 object, or NULL to save the current plot |
name |
The name for the output file (without extension) |
format |
Output format: "png" (default), "pdf", "svg", or "jpg" |
width |
Width in inches (default: 8) |
height |
Height in inches (default: 6) |
dpi |
Resolution in dots per inch (default: 300) |
public |
If TRUE, saves to public outputs directory (for project_sensitive type) |
overwrite |
If TRUE, overwrites existing files (default: TRUE) |
... |
Additional arguments passed to ggsave or the graphics device |
The path to the saved file (invisibly)
if (FALSE) { # Save a ggplot p <- ggplot(mtcars, aes(mpg, hp)) + geom_point() save_figure(p, "mpg_vs_hp") # Save as PDF for publication save_figure(p, "mpg_vs_hp", format = "pdf", width = 10, height = 8) # Save to public directory save_figure(p, "summary_plot", public = TRUE) }if (FALSE) { # Save a ggplot p <- ggplot(mtcars, aes(mpg, hp)) + geom_point() save_figure(p, "mpg_vs_hp") # Save as PDF for publication save_figure(p, "mpg_vs_hp", format = "pdf", width = 10, height = 8) # Save to public directory save_figure(p, "summary_plot", public = TRUE) }
Saves a fitted model object to the configured models directory. The directory is created lazily on first use.
save_model(model, name, public = FALSE, overwrite = TRUE, ...)save_model(model, name, public = FALSE, overwrite = TRUE, ...)
model |
A fitted model object (lm, glm, tidymodels workflow, etc.) |
name |
The name for the output file (without extension) |
public |
If TRUE, saves to public outputs directory (for project_sensitive type) |
overwrite |
If TRUE, overwrites existing files (default: TRUE) |
... |
Additional arguments passed to |
The path to the saved file (invisibly)
if (FALSE) { # Fit and save a model model <- lm(mpg ~ hp + wt, data = mtcars) save_model(model, "mpg_regression") }if (FALSE) { # Fit and save a model model <- lm(mpg ~ hp + wt, data = mtcars) save_model(model, "mpg_regression") }
Renders a Quarto or R Markdown notebook and saves the output to the configured notebooks output directory. The directory is created lazily on first use.
save_notebook( file, name = NULL, format = "html", public = FALSE, overwrite = TRUE, embed_resources = TRUE, ... )save_notebook( file, name = NULL, format = "html", public = FALSE, overwrite = TRUE, embed_resources = TRUE, ... )
file |
Path to the .qmd or .Rmd file to render |
name |
Optional new name for the output file (without extension). If NULL, uses the original notebook name. |
format |
Output format: "html" (default), "pdf", or "docx" |
public |
If TRUE, saves to public outputs directory (for project_sensitive type) |
overwrite |
If TRUE, overwrites existing files (default: TRUE) |
embed_resources |
If TRUE, creates a self-contained file with embedded resources (default: TRUE for html format) |
... |
Additional arguments passed to quarto render |
The path to the saved file (invisibly)
if (FALSE) { # Render and save a notebook save_notebook("notebooks/analysis.qmd") # Save with a custom name save_notebook("notebooks/analysis.qmd", name = "final_analysis") # Render to PDF save_notebook("notebooks/analysis.qmd", format = "pdf") # Save to public directory (for sensitive projects) save_notebook("notebooks/analysis.qmd", public = TRUE) }if (FALSE) { # Render and save a notebook save_notebook("notebooks/analysis.qmd") # Save with a custom name save_notebook("notebooks/analysis.qmd", name = "final_analysis") # Render to PDF save_notebook("notebooks/analysis.qmd", format = "pdf") # Save to public directory (for sensitive projects) save_notebook("notebooks/analysis.qmd", public = TRUE) }
Copies or moves a rendered report (HTML, PDF, etc.) to the configured reports directory. The directory is created lazily on first use.
save_report(file, name = NULL, public = FALSE, overwrite = TRUE, move = FALSE)save_report(file, name = NULL, public = FALSE, overwrite = TRUE, move = FALSE)
file |
Path to the report file to save |
name |
Optional new name for the file (without extension). If NULL, uses original name. |
public |
If TRUE, saves to public outputs directory (for project_sensitive type) |
overwrite |
If TRUE, overwrites existing files (default: TRUE) |
move |
If TRUE, moves the file instead of copying (default: FALSE) |
The path to the saved file (invisibly)
if (FALSE) { # Save a rendered HTML report save_report("notebooks/analysis.html", "final_analysis") # Save to public directory save_report("notebooks/summary.pdf", "public_summary", public = TRUE) }if (FALSE) { # Save a rendered HTML report save_report("notebooks/analysis.html", "final_analysis") # Save to public directory save_report("notebooks/summary.pdf", "public_summary", public = TRUE) }
Saves a data frame or tibble to the configured tables directory. The directory is created lazily on first use.
save_table(data, name, format = "csv", public = FALSE, overwrite = TRUE, ...)save_table(data, name, format = "csv", public = FALSE, overwrite = TRUE, ...)
data |
A data frame, tibble, or other tabular data |
name |
The name for the output file (without extension) |
format |
Output format: "csv" (default), "rds", "xlsx", or "parquet" |
public |
If TRUE, saves to public outputs directory (for project_sensitive type) |
overwrite |
If TRUE, overwrites existing files (default: TRUE) |
... |
Additional arguments passed to the underlying write function |
The path to the saved file (invisibly)
if (FALSE) { # Save a simple table save_table(my_results, "regression_results") # Save as Excel save_table(my_results, "regression_results", format = "xlsx") # Save to public directory (for sensitive projects) save_table(summary_stats, "summary", public = TRUE) }if (FALSE) { # Save a simple table save_table(my_results, "regression_results") # Save as Excel save_table(my_results, "regression_results", format = "xlsx") # Save to public directory (for sensitive projects) save_table(summary_stats, "summary", public = TRUE) }
The primary entry point for working with Framework projects. Call this at the start of every notebook or script to set up your environment with all configured packages, functions, and settings.
scaffold(config_file = NULL)scaffold(config_file = NULL)
config_file |
Path to configuration file. If NULL (default), automatically discovers settings.yml or config.yml in the project. |
scaffold() performs the following steps in order:
Standardizes working directory - Finds and sets the project root, even when called from notebooks in subdirectories
Loads environment variables - Reads secrets from .env file
Loads configuration - Parses settings.yml for project settings
Sets random seed - For reproducibility (if seed is configured)
Installs packages - Any missing packages from the packages list
Loads packages - Attaches all configured packages
Sources functions - Loads all .R files from functions/ directory
After scaffold() completes, you have access to:
All packages listed in settings.yml
All functions from your functions/ directory
Settings via settings("key") helper function
Database connections configured in your project
Invisibly returns NULL. The main effects are side effects:
loading packages, sourcing functions, and creating the config object.
When called without arguments, scaffold() searches for a Framework project by:
Looking for settings.yml or config.yml in current and parent directories
Checking for .Rproj or .code-workspace files with nearby settings
Recognizing common Framework subdirectories (notebooks/, scripts/, etc.)
This means you can call scaffold() from any subdirectory within your project.
The settings.yml file controls what scaffold() loads. Key settings include:
packages: List of R packages to install and load
seed: Random seed for reproducibility
directories: Custom directory paths
connections: Database connection configurations
project_create() to create a new Framework project
standardize_wd() for just the working directory standardization
settings() to access configuration values after scaffolding
if (FALSE) { # At the top of every notebook or script: library(framework) scaffold() # Now you can use your configured packages and functions # Access settings via the settings() helper: settings("directories.notebooks") settings("seed") }if (FALSE) { # At the top of every notebook or script: library(framework) scaffold() # Now you can use your configured packages and functions # Access settings via the settings() helper: settings("directories.notebooks") settings("seed") }
Saves data to a file in various formats based on the object type and specified format. If no name is provided, uses the name of the object passed in. If no location is provided, uses the scratch directory from the configuration.
scratch_capture(x, name = NULL, to = NULL, location = NULL, n = Inf)scratch_capture(x, name = NULL, to = NULL, location = NULL, n = Inf)
x |
The object to save |
name |
Optional character string specifying the name of the file (without extension). If not provided, will use the name of the object passed in. |
to |
Optional character string indicating the output format. One of: "text", "rds", "csv", "tsv". If not provided, will choose based on object type. |
location |
Optional character string specifying the directory where the file should be saved. If NULL, uses the scratch directory from the configuration. |
n |
Optional number of rows to capture for data frames (default: all rows) |
The input object x invisibly.
if (FALSE) { # Save a character vector as text scratch_capture(c("hello", "world")) # Save a data frame as TSV scratch_capture(mtcars) # Save an R object as RDS scratch_capture(list(a = 1, b = 2), to = "rds") }if (FALSE) { # Save a character vector as text scratch_capture(c("hello", "world")) # Save a data frame as TSV scratch_capture(mtcars) # Save an R object as RDS scratch_capture(list(a = 1, b = 2), to = "rds") }
Clean up the scratch directory by deleting all files
scratch_clean()scratch_clean()
Invisibly returns NULL. Called for side effect of removing scratch files.
Framework's primary configuration helper that supports both flat and hierarchical key access using dot notation. Automatically checks common locations for directory settings. Pretty-prints nested structures in interactive sessions.
settings(key = NULL, default = NULL, settings_file = NULL)settings(key = NULL, default = NULL, settings_file = NULL)
key |
Character. Dot-notation key path (e.g., "notebooks" or "directories.notebooks" or "connections.db.host"). If NULL, returns entire settings. |
default |
Optional default value if key is not found (default: NULL) |
settings_file |
Settings file path (default: checks "settings.yml" then "settings.yml") |
For directory settings, the function checks multiple locations:
Direct: settings("notebooks") checks directories$notebooks, then options$notebook_dir
Explicit: settings("directories.notebooks") checks only directories$notebooks
File Discovery:
Checks settings.yml first (Framework's preferred convention)
Falls back to settings.yml if settings.yml not found
You can override with explicit settings_file parameter
Output Behavior:
Interactive sessions: Pretty-prints nested lists/structures and returns invisibly
Non-interactive (scripts): Returns raw value without printing
Simple values: Always returned directly without modification
The settings value, or default if not found. In interactive sessions, nested structures are pretty-printed and returned invisibly.
if (FALSE) { # Get notebook directory (checks both locations) settings("notebooks") # Get explicit nested setting settings("directories.notebooks") settings("connections.db.host") # Get entire section settings("directories") # Returns all directory settings settings("connections") # Returns all connection settings # View entire settings settings() # Returns full configuration # With default value settings("missing_key", default = "fallback") }if (FALSE) { # Get notebook directory (checks both locations) settings("notebooks") # Get explicit nested setting settings("directories.notebooks") settings("connections.db.host") # Get entire section settings("directories") # Returns all directory settings settings("connections") # Returns all connection settings # View entire settings settings() # Returns full configuration # With default value settings("missing_key", default = "fallback") }
Reads the project settings from settings.yml or config.yml with environment-aware merging and split file resolution. Auto-discovers the settings file if not specified.
settings_read(settings_file = NULL, environment = NULL)settings_read(settings_file = NULL, environment = NULL)
settings_file |
Path to settings file (default: auto-discover settings.yml or config.yml) |
environment |
Active environment name (default: R_CONFIG_ACTIVE or "default") |
The settings as a list
Writes the project settings to settings.yml or config files
settings_write(settings, settings_file = NULL, section = NULL)settings_write(settings, settings_file = NULL, section = NULL)
settings |
The settings list to write |
settings_file |
The settings file path (default: auto-detect settings.yml/config.yml) |
section |
Optional section to update (e.g. "data") |
Invisibly returns NULL.
Initializes Framework's global configuration and launches the GUI for first-time setup. This is the recommended entry point for new users.
setup(port = 8080, browse = TRUE)setup(port = 8080, browse = TRUE)
port |
Port number to use (default: 8080) |
browse |
Automatically open browser (default: TRUE) |
Use this function after installing Framework to:
Set your author name and email
Configure default packages for new projects
Set IDE preferences (VS Code, RStudio)
Configure other global defaults
Invisibly returns the plumber server object
gui() for launching the GUI without initialization check
if (FALSE) { # First-time setup framework::setup() }if (FALSE) { # First-time setup framework::setup() }
This function helps standardize the working directory when working with framework projects, especially useful in Quarto/RMarkdown documents that may be rendered from subdirectories.
standardize_wd(project_root = NULL)standardize_wd(project_root = NULL)
project_root |
Character string specifying the project root directory. If NULL (default), the function will attempt to find it automatically. |
The function looks for common framework project indicators:
settings.yml or settings.yml file
.Rprofile file
Being in common subdirectories (scratch, work)
It sets both the regular working directory and knitr's root.dir option if knitr is available.
Invisibly returns the standardized project root path.
if (FALSE) { library(framework) standardize_wd() scaffold() }if (FALSE) { library(framework) standardize_wd() scaffold() }
Displays comprehensive information about the current Framework project including:
Framework package version
Project configuration
Git status
AI assistant configuration
Git hooks status
Package dependencies
Directory structure
status()status()
No return value, called for side effect of printing project status.
if (FALSE) { status() }if (FALSE) { status() }
Validates that S3/storage credentials and bucket access are working.
storage_test(connection = NULL)storage_test(connection = NULL)
connection |
Character or NULL. Connection name, or NULL for default. |
Logical. TRUE if connection is valid.
if (FALSE) { # Test default storage connection storage_test() # Test specific connection storage_test("my_s3_backup") }if (FALSE) { # Test default storage connection storage_test() # Test specific connection storage_test("my_s3_backup") }
Shows all available stub templates that can be used with make_notebook().
stubs_list(type = NULL)stubs_list(type = NULL)
type |
Character. Filter by type: "quarto", "rmarkdown", "script", or NULL (all). |
Data frame with columns: name, type, source (user/framework)
if (FALSE) { # List all stubs stubs_list() # List only Quarto stubs stubs_list("quarto") # List only script stubs stubs_list("script") }if (FALSE) { # List all stubs stubs_list() # List only Quarto stubs stubs_list("quarto") # List only script stubs stubs_list("script") }
Returns the path to the user's stubs directory, or the framework stubs directory if no user stubs exist.
stubs_path(which = "auto")stubs_path(which = "auto")
which |
Character. Which directory to return:
|
Character path to stubs directory
if (FALSE) { # Get active stubs directory stubs_path() # Get framework stubs directory stubs_path("framework") # Get user stubs directory stubs_path("user") }if (FALSE) { # Get active stubs directory stubs_path() # Get framework stubs directory stubs_path("framework") # Get user stubs directory stubs_path("user") }
Copies framework stub templates to your project's stubs/ directory, allowing
you to customize them. Similar to Laravel's artisan vendor:publish command.
stubs_publish(type = "all", overwrite = FALSE, stubs = NULL)stubs_publish(type = "all", overwrite = FALSE, stubs = NULL)
type |
Character vector. Which stub types to publish:
|
overwrite |
Logical. Whether to overwrite existing stubs. Default FALSE. |
stubs |
Character vector. Specific stub names to publish (e.g., "default", "minimal"). If NULL (default), publishes all stubs of the specified type. |
Publish stubs to your project: stubs_publish()
Edit stubs in stubs/ directory to match your preferences
Use make_notebook() or make_script() - your custom stubs are used automatically
Stubs follow this naming pattern:
Notebooks: stubs/notebook-{name}.qmd or stubs/notebook-{name}.Rmd
Scripts: stubs/script-{name}.R
Framework searches user stubs first, then falls back to built-in stubs.
Stubs can use these placeholders:
{filename} - File name without extension
{date} - Current date (YYYY-MM-DD)
Invisible list of published file paths
make_notebook(), make_script(), stubs_list(), stubs_path()
if (FALSE) { # Publish all stubs stubs_publish() # Publish only notebook stubs stubs_publish("notebooks") # Publish specific stub stubs_publish(stubs = "default") # Overwrite existing stubs stubs_publish(overwrite = TRUE) }if (FALSE) { # Publish all stubs stubs_publish() # Publish only notebook stubs stubs_publish("notebooks") # Publish specific stub stubs_publish(stubs = "default") # Overwrite existing stubs stubs_publish(overwrite = TRUE) }
Opens an interactive, browser-based viewer for R objects. This is the primary function for viewing data frames, plots, lists, and other R objects with enhanced formatting.
view(x, title = NULL, max_rows = 5000)view(x, title = NULL, max_rows = 5000)
x |
The data to view (data.frame, plot, list, function, or other R object) |
title |
Optional title for the view. If NULL, uses the object name. |
max_rows |
Maximum number of rows to display for data frames (default: 5000). |
Invisibly returns NULL. Opens a browser window.
if (FALSE) { # View a data frame view(mtcars) # View with a title view(iris, title = "Iris Dataset") # View a ggplot library(ggplot2) p <- ggplot(mtcars, aes(mpg, hp)) + geom_point() view(p) }if (FALSE) { # View a data frame view(mtcars) # View with a title view(iris, title = "Iris Dataset") # View a ggplot library(ggplot2) p <- ggplot(mtcars, aes(mpg, hp)) + geom_point() view(p) }
Overwrite a Framework template with new contents
write_framework_template(name, contents)write_framework_template(name, contents)
name |
Template identifier (e.g., "notebook", "gitignore", "ai_claude") |
contents |
Character string to write to the template file. |
Invisibly returns the file path of the written template.
Write global Framework configuration
write_frameworkrc(config)write_frameworkrc(config)
config |
List containing configuration to write |
Invisibly returns NULL