# infer_unitizer_location

0th

Percentile

##### 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.

##### Usage
infer_unitizer_location(store.id, ...)# S3 method for default
infer_unitizer_location(store.id, ...)# S3 method for character
infer_unitizer_location(store.id, type = "f",
interactive.mode = interactive(), ...)
##### Arguments
store.id

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

type

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

interactive.mode

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

##### Details

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

If store.id 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(store.id, "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 store.id 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 store.id. If the parent package directory cannot be found, then the character method is called with the current directory as the argument.

##### Value

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

get_unitizer for discussion of alternate store.id objects