Title: | A Tool to Downsize Large Analysis Projects for Testing |
Version: | 0.2.3 |
Description: | Toggles the test and production versions of a large data analysis project. |
License: | GPL (≥ 3) |
Depends: | R (≥ 3.0.0) |
Imports: | magrittr, R.utils, utils |
Suggests: | knitr, rmarkdown, testthat |
VignetteBuilder: | knitr |
URL: | https://github.com/wlandau/downsize |
BugReports: | https://github.com/wlandau/downsize/issues |
RoxygenNote: | 7.2.3 |
Encoding: | UTF-8 |
Language: | en-US |
NeedsCompilation: | no |
Packaged: | 2023-03-16 16:27:56 UTC; c240390 |
Author: | William Michael Landau [aut, cph, cre] |
Maintainer: | William Michael Landau <will.landau@gmail.com> |
Repository: | CRAN |
Date/Publication: | 2023-03-16 17:40:10 UTC |
Internal utility function.
Description
Utility function. Make downsized object out of
argument small
to downsize
.
Usage
arg_small(args)
Arguments
args |
named list of arguments to |
See Also
Internal utility function.
Description
Utility function. Checks that arguments are valid.
Usage
check_args(args)
Arguments
args |
named list of arguments to |
See Also
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 |
small |
Object to return if |
downsize |
|
warn |
|
random |
If |
length |
Downsize |
dim |
Downsize |
ncol |
Downsize |
nrow |
Downsize |
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.
See Also
help_downsize
, test_mode
,
production_mode
, my_mode
Internal utility function.
Description
Utility function. Throw an error when downsizing fails.
Usage
downsize_error(arg_name)
Arguments
arg_name |
name of an argument to |
See Also
Function ds
. Deprecated.
Description
Deprecated. Use function downsize
instead.
See help_downsize
for help.
Usage
ds(
big,
small = NULL,
downsize = getOption("downsize"),
warn = TRUE,
random = FALSE,
length = NULL,
dim = NULL,
ncol = NULL,
nrow = NULL
)
Arguments
big |
Object to return if |
small |
Object to return if |
downsize |
|
warn |
|
random |
If |
length |
Downsize |
dim |
Downsize |
ncol |
Downsize |
nrow |
Downsize |
Value
A downsized object if downsize
is TRUE
and big
otherwise.
See Also
help_downsize
, downsize
, scale_down
,
scale_up
, scaling
Function help_downsize
Description
Prints links for tutorials, troubleshooting, bug reports, etc.
Usage
help_downsize()
See Also
downsize
, scale_down
,
scale_up
, scaling
Internal utility function.
Description
Utility function. Inside function downsize
,
make "small" out of "big"
by subsetting or some other method. This is called if any of
the subsetting arguments to downsize
are set (length, dim, etc.)
Usage
make_small(args)
Arguments
args |
named list of arguments to |
See Also
Function my_mode
Description
Check whether the current workflow is production mode or test mode.
Use the help_downsize
function to get more help.
Usage
my_mode()
Details
Use the help_downsize
function to get more help.
Value
"test mode"
if getOption("downsize")
is TRUE
and "production mode" if getOption("downsize")
is FALSE
or NULL
.
See Also
help_downsize
, downsize
,
test_mode
, production_mode
Function production_mode
Description
Calls options(downsize = FALSE)
to scale up a workflow
to production mode.
This affects the downsize
function.
Use the help_downsize
function to get more help.
Usage
production_mode()
Details
Use the help_downsize
function to get more help.
See Also
help_downsize
, downsize
,
test_mode
, my_mode
Deprecated function scale_down
Description
Deprecated. Use test_mode
instead.
Calls options(downsize = TRUE)
to scale down a workflow.
This affects the downsize
function.
Use the help_downsize
function to get more help.
Usage
scale_down()
Details
Use the help_downsize
function to get more help.
See Also
help_downsize
, test_mode
scaling
Deprecated function scale_up
Description
Deprecated. Use production_mode
instead.
Calls options(downsize = FALSE)
to scale up a workflow.
This affects the downsize
function.
Use the help_downsize
function to get more help.
Usage
scale_up()
Details
Use the help_downsize
function to get more help.
See Also
help_downsize
, production_mode
Deprecated function scaling
Description
Deprecated. Use my_mode
instead.
Checks whether the current workflow is scaled up or down.
Use the help_downsize
function to get more help.
Usage
scaling()
Details
Use the help_downsize
function to get more help.
Value
"scaled down"
if getOption("downsize")
is TRUE
and "scaled up" if getOption("downsize")
is FALSE
or NULL
.
See Also
Internal utility function.
Description
Utility function. TRUE/FALSE: should the downsize
function return
a downsized replacement for "big"?
Usage
should_downsize(downsize)
Arguments
downsize |
argument to |
See Also
Internal utility function.
Description
Utility function. Subset an object x
with a
dim
attribute (matrix/array/data.frame/etc.)
and return another with dimensions pmin(dim, dim(x))
Usage
subset_dim(x, dim, random)
Arguments
x |
object to subset |
dim |
new dimensions |
random |
logical, whether to take a random subset or just the head. |
See Also
Internal utility function.
Description
Utility function. Subset a vector/list/etc.
x
and return another with length min(length, length(x))
Usage
subset_length(x, length, random)
Arguments
x |
object to subset |
length |
new length |
random |
logical, whether to take a random subset or just the head. |
See Also
Internal utility function.
Description
Utility function. Subset an object x
with columns and
return another with min(ncol, ncol(x)) columns.
Usage
subset_ncol(x, ncol, random)
Arguments
x |
object to subset |
ncol |
new number of columns |
random |
logical, whether to take a random subset or just the head. |
See Also
Internal utility function.
Description
Utility function. Subset an object x
with rows and
return another with min(nrow, nrow(x)) columns.
Usage
subset_nrow(x, nrow, random)
Arguments
x |
object to subset |
nrow |
new number of rows |
random |
logical, whether to take a random subset or just the head. |
See Also
Internal utility function.
Description
Utility function. Same as subset_dim, but along the
single dimension with index which_dim
.
Usage
subset_single_dim(x, which_dim, dim_length, random)
Arguments
x |
object to subset |
which_dim |
index of dimension along which to subset |
dim_length |
new length/size of the dimension of |
random |
logical, whether to take a random subset or just the head. |
See Also
Function test_mode
Description
Calls options(downsize = TRUE)
to scale down a workflow
to test mode.
This affects the downsize
function.
Use the help_downsize
function to get more help.
Usage
test_mode()
Details
Use the help_downsize
function to get more help.
See Also
help_downsize
, downsize
, production_mode
, my_mode
,
my_mode
Internal utility function.
Description
Utility function. Should the "small" argument to
downsize
be used? Returns TRUE
if none
of the subsetting arguments (length, dim, etc.) or similar is set.
Usage
use_arg_small(args)
Arguments
args |
named list of arguments to |