add_standard_attr: Add informative attributes to an object

View source: R/add_standard_attr.R

add_standard_attrR Documentation

Add informative attributes to an object

Description

This function adds informative attributes to an object, including the source of the script that produced the object, a title, description and details of any parameters (if requested) and the date/time of file creation. These attributes help to maintain the links between the scripts in which objects are produced and any saved objects.

Usage

add_standard_attr(
  x,
  title = deparse(substitute(x)),
  description = NULL,
  param = NULL
)

Arguments

x

An object.

title

A string providing an informative title for the object.

description

A string providing an informative description of the object.

param

An object (e.g., a string) containing further details about an object.

Details

This function requires rstudioapi.

Value

The function returns the object, x, as inputted with standard attributes.

Author(s)

Edward Lavender

Examples

## Not run: 
x <- runif(10, 0, 1)
out <- add_standard_attr(x)
attributes(out)
out <- add_standard_attr(x, title = "A numeric vector")
attributes(out)

## End(Not run)


edwardlavender/utils.add documentation built on Dec. 14, 2024, 8:11 a.m.