xObjSize | R Documentation

## Function to estimate memory allocated for an R variable or a file

### Description

`xObjSize` is supposed to estimate memory allocated for an R variable or a file.

### Usage

    xObjSize(obj, type = c("auto", "variable", "file"), units = "auto",
    verbose = TRUE)

### Arguments

`obj` | character specifying an R variable or a local file
`type` | the object type specifying an R object or a local file. It can be 'variable', 'file' or 'auto' (by default; automatically determined)
`units` | the units to be used in formatting the size. It can be 'auto', 'Kb', 'Mb', 'Gb', 'Tb', 'Pb'
`verbose` | logical to indicate whether the messages will be displayed in the screen. By default, it sets to TRUE for display

### Value

If action is logical, a list containing arguments and their default values. If action is NULL, a string specifying the assignment to be evalated.

### Note

This function is potentially useful when debugging as it frees developers from specifying default values for all arguments except those arguments of interest

### See Also

`xObjSize`

### Examples

    xObjSize(ls()[1])
    #res <- lapply(ls(), xObjSize)
    #res <- lapply(list.files(), xObjSize)