A database name is constructed to in the form PREFIX_USERNAME[_SUFFIX].db, where the upper-case items are inferred from corresponding parameters.

getDatabaseName(prefix, username, suffix, path = "~")

Arguments

prefix

character value indicating the prefix for the database name. Often, this will be the name of a project, or application.

username

character value for the user's login name. If not provided, an attempt is made to construct this using Sys.info().

suffix

optional character value that may be included in the filename, if provided.

path

character value indicating the directory to contain the file. This defaults to the present directory.

Value

getDatabaseName returns a character value constructed by stringing prefix, username (and possibly suffix) together, separated by underscore characters, with .db being added to the end; see ‘Examples’.

Author

Dan Kelley

Examples

getDatabaseName() # ~/kelley.db, for the author
#> [1] "~/kelley.db"
getDatabaseName(path="~/databases") # ~/databases/kelley.db, for the author
#> [1] "~/databases/kelley.db"
getDatabaseName("foo") # ~/foo_kelley.db, for the author
#> [1] "~/foo_kelley.db"
getDatabaseName("foo", "bar") # ~/foo_bar.db
#> [1] "~/foo_bar.db"
getDatabaseName("foo", "bar", "01") # ~/foo_bar_01.db
#> [1] "~/foo_bar_01.db"