Learn R Programming

gooseR (version 0.1.2)

goose_save: Save R Object to Goose Memory

Description

Save an R object to Goose's memory system with optional tags and category. Objects are serialized to RDS format and metadata is stored in Goose's text format.

Usage

goose_save(
  object,
  name,
  category = "r_objects",
  tags = NULL,
  description = NULL,
  global = TRUE,
  overwrite = FALSE
)

Value

Invisibly returns the path where the object was saved

Arguments

object

The R object to save (can be any R object: data.frame, model, list, etc.)

name

Character string. Name for the saved object (will be used as filename)

category

Character string. Category for organizing memories (default: "r_objects")

tags

Character vector. Optional tags for searching/filtering

description

Character string. Optional description of the object

global

Logical. If TRUE (default), saves to global Goose memory. If FALSE, saves to project-local memory.

overwrite

Logical. If TRUE, overwrites existing object. If FALSE (default), errors if object exists.

Examples

Run this code
if (FALSE) {
# Save a model
model <- lm(mpg ~ wt, data = mtcars)
goose_save(model, "mtcars_model", 
           category = "models",
           tags = c("regression", "mtcars"),
           description = "Linear model predicting mpg from weight")

# Save a data frame
goose_save(iris, "iris_data", 
           category = "datasets",
           tags = "example")
}

Run the code above in your browser using DataLab