Learn R Programming

whoami (version 1.3.0)

whoami: User name and full name of the current user

Description

Calls username and fullname.

Usage

whoami()

Arguments

Value

A named character vector with entries: username, fullname, email_address, gh_username.

Details

For the username it tries the LOGNAME, USER, LNAME and USERNAME environment variables first. If these are all unset, or set to an empty string, then it tries running id on Unix-like systems and whoami on Windows.

For the full name of the user, it queries the system services and also tries the user's global git configuration. On Windows, it tries finding the global git configuration in Sys.getenv("USERPROFILE") if it doesn't find it in Sys.getenv("HOME") (often "Documents").

For the email address it uses the user's global git configuration. It tries finding the global git configuration in Sys.getenv("USERPROFILE") if it doesn't find it in Sys.getenv("HOME").

For the GitHub username it uses the GITHUB_USERNAME environment variable then it tries searching on GitHub for the user's email address.

See Also

Other user names: email_address, fullname, gh_username, username

Examples

Run this code
# NOT RUN {
whoami()
# }

Run the code above in your browser using DataLab