Infers Possible Unitizer Path From Context

Used by most unitizer functions that operate on unitizers to make it easy to specify the most likely intended unitizer in a package or a directory.

infer_unitizer_location(, ...)

# S3 method for default infer_unitizer_location(, ...)

# S3 method for character infer_unitizer_location(, type = "f", interactive.mode = interactive(), ...)


character(1L) file or directory name, the file name portion (i.e after the last slash) may be partially specified


arguments to pass on to other methods


character(1L) in c("f", "u", "d"), "f" for test file, "d" for a directory, "u" for a unitizer directory


logical(1L) whether to allow user input to resolve ambiguities


This is implemented as an S3 generic to allow third parties to define inference methods for other types of, but the documentation here is for the "character" method which is what unitizer uses by default.

If is a directory that appears to be an R package (contains DESCRIPTION, an R folder, a tests folder), will look for candidate files in file.path(, "tests", "unitizer"), starting with files with the same name as the package (ending in ".R" or ".unitizer" if type is "f" or "u" respectively), or if there is only one file, that file, or if there are multiple candidate files and in interactive mode prompting user for a selection. If type is "d", then will just provide the "tests/unitizer" directory.

If name is not a directory, will try to find a file by that name, and if that fails, will try to partially match a file by that name. Partial matching requires the front portion of the name to be fully specified and no extension be provided (e.g. for "mytests.R", "myt" is valid, but "tests" and "myt.R" are both invalid). Partially specified files may be specified in subdirectories (e.g. "tests/myt").

Inference assumes your files end in ".R" for code files and ".unitizer" for unitizer data directories.

If is NULL, the default infer_unitizer_location method will attempt to find the top level package directory and then call the character method with that directory as If the parent package directory cannot be found, then the character method is called with the current directory as the argument.


character(1L) an inferred path, or with a warning if path cannot be inferred

See Also

get_unitizer for discussion of alternate objects

  • infer_unitizer_location
  • infer_unitizer_location.default
  • infer_unitizer_location.character
Documentation reproduced from package unitizer, version 1.4.5, License: GPL (>= 2)

Community examples

Looks like there are no examples yet.