list_objects: List Data and Function Objects in the Current Environment

View source: R/list_objects.R

list_objectsR Documentation

List Data and Function Objects in the Current Environment

Description

This function lists all data and function objects in the current R environment. It can sort the data objects by name or size and display their sizes in a readable format.

Usage

list_objects(sort_by = "name", display = "both")

Arguments

sort_by

A character string specifying the sort order for data objects. Can be "name" (default) or "size".

display

A character string specifying which objects to display. Can be "both" (default), "data", or "functions".

Value

Prints the names and sizes of data and function objects in the current environment, and the total size of all data objects.

Examples

## Not run: 
  # Create some example data objects and functions
  x <- 1:10
  y <- data.frame(a = 1:5, b = 6:10)
  z <- "Hello, world!"
  my_func <- function(x) { x + 1 }

  # Print objects sorted by name
  list_objects()

  # Print data objects sorted by size
  list_objects(sort_by = "size")

  # Print only data objects sorted by name
  list_objects(display = "data")

  # Print only functions sorted by name
  list_objects(display = "functions")

## End(Not run)

natehall329/nate_utils documentation built on Dec. 31, 2024, 3:25 p.m.