lsos: List objects and their characteristics

View source: R/lsos.R

.ls.objectsR Documentation

List objects and their characteristics

Description

lsos() and ls.objects() are like ls() in that they list the objects in a given environment. But they provide more detail: they show the class of each object, the amount of memory devoted to each objects, and the number of rows or columns of each object (if applicable).

Usage

.ls.objects(
  pos = 1,
  envir = as.environment(pos),
  pattern,
  order.by,
  decreasing = FALSE,
  MB = MB,
  n = NULL
)

lsos(..., MB = TRUE, n = 8)

Arguments

pos

Numeric. Specifies the position, in the search list, of the environment to search. Can be specified instead of envir.

envir

Environment to search. Can be specified instead of pos.

pattern

String. An optional regular expression; if it is specified, only objects whose names match the regular expression will be returned.

order.by

String, with value "Class", "Size", "Rows", or "Columns." The returned data frame will be sorted by the specified column.

decreasing

Logical variable. Should results be listed in decreasing order of the order.by column? In .ls.objects() the default is FALSE; in lsos(), it is TRUE.

MB

Logical. If TRUE (the default), object size is reported in megabytes. If FALSE, it is reported in kilobytes.

n

Numeric. Number of objects to list. In lsos(), the default is\NB8.

...

Additional arguments to .ls.objects().

Details

lsos() is a user-friendly wrapper for .ls.objects(). It is shorthand for .ls.objects(order.by="Size", decreasing=TRUE, head=TRUE, n=8).

Both functions were created by Dirk Edelbuettel and modified by JD Long and John Bullock. See http://stackoverflow.com/questions/1358003/ for details.

Value

Data frame with columns "Class," "Size," "Row," and "Columns." The row names of the data frame are the names of objects in the environment.

Author(s)

Both functions were created by Dirk Edelbuettel and modified by JD Long and John Bullock. See http://stackoverflow.com/questions/1358003/ for details.

Examples

lsos()
lsos(pattern = '\\.df$')  # list only objects ending in ".df"

jbullock35/Bullock documentation built on April 1, 2022, 6:21 p.m.