downsize {downsize} R Documentation

## Function downsize. Main function of the downsize package.

### Description

Replace big with a downsized object if the downsize argument (or the downsize global option) is TRUE. The downsize global option can be toggled with functions test_mode and production_mode. Use the help_downsize function to get more help.

### Usage

downsize(big, small = NULL, downsize = getOption("downsize"), warn = TRUE,
random = FALSE, length = NULL, dim = NULL, ncol = NULL, nrow = NULL)


### Arguments

 big Object to return if downsize is FALSE or NULL. small Object to return if downsize is TRUE and all subsetter arguments such as length and dim are NULL. downsize TRUE/FALSE value (NULL counts as FALSE), whether to replace big with a downsized object. Defaults to the global option downsize, which you can check with getOption("downsize") or the my_mode function and set with functions downsize, test_mode or production_mode. warn TRUE/FALSE option to warn the user if big and small are identical or big is smaller in memory than small. random If TRUE, take a random subset of big instead of the first few elements. For example, if nrow == 3, take a random 3 rows instead of the first 3. length Downsize big to this length if downsize is TRUE. dim Downsize big to these dimensions if downsize is TRUE. ncol Downsize big to this number of columns if downsize is TRUE. nrow Downsize big to this number of rows if downsize is TRUE.

### Details

Use the help_downsize function to get more help. If the downsize argument is TRUE, a downsized replacement for big will be returned. In this case, argument small takes precedence over subsetter arguments such as dim, length, nrow, and ncol. That is, if small is not NULL, then small will be returned even if dim is not NULL. If the downsize argument is not set manually, the downsize global option will be used. The downsize global option can be toggled with functions test_mode and production_mode.

### Value

A downsized object if downsize is TRUE and big otherwise.

help_downsize, test_mode, production_mode, my_mode