Rdocumentation
powered by
Learn R Programming
R.utils (version 2.13.0)
Various Programming Utilities
Description
Utility functions useful when programming and developing R packages.
Copy Link
Link to current version
Version
Version
2.13.0
2.12.3
2.12.2
2.12.1
2.12.0
2.11.0
2.10.1
2.9.2
2.9.1
2.9.0
2.8.0
2.7.0
2.6.0
2.5.0
2.4.0
2.3.0
2.2.0
2.1.0
2.0.2
2.0.1
2.0.0
1.34.0
1.33.0
1.32.4
1.29.8
1.28.4
1.27.1
1.26.2
1.26.0
1.25.2
1.23.2
1.19.5
1.19.3
1.18.0
1.16.2
1.16.0
1.12.1
1.12.0
1.9.11
1.9.9
1.9.7
1.9.6
1.9.4
1.9.3
1.8.7
1.8.5
1.8.2
1.8.1
1.7.8
1.7.7
1.7.5
1.7.4
1.7.3
1.7.2
1.7.0
1.6.5
1.6.4
1.6.3
1.6.2
1.6.1
1.6.0
1.5.8
1.5.7
1.5.6
1.5.3
1.5.2
1.5.0
1.4.4
1.4.3
1.4.2
1.4.0
1.3.3
1.3.2
1.3.0
1.2.4
1.2.2
1.2.0
1.1.7
1.1.1
1.1.0
1.0.1
0.9.8
0.9.7
0.9.6
0.9.5
0.9.1
0.9.0
0.8.9
0.8.0
0.7.9
0.7.7
0.5.5
Install
install.packages('R.utils')
Monthly Downloads
181,629
Version
2.13.0
License
LGPL (>= 2.1)
Issues
30
Pull Requests
1
Stars
63
Forks
13
Repository
https://github.com/HenrikBengtsson/R.utils
Homepage
https://henrikbengtsson.github.io/R.utils/
Maintainer
Henrik Bengtsson
Last Published
February 24th, 2025
Functions in R.utils (2.13.0)
Search all functions
.Last.lib
Undo changed done by this package when detached
LComments
The LComments class
Arguments
Static class to validate and process arguments
MultiVerbose
A Verbose class ignoring everything
R.utils-package
Package R.utils
SmartComments
Abstract class SmartComments
Sys.readlink2
Read File Symbolic Links (also on Windows)
Settings
Class for applicational settings
Verbose
Class to writing verbose messages to a connection or file
as.double.Verbose
Gets a numeric value of this object
as.list.MultiVerbose
Gets a list of Verbose objects
Java$asLong
Converts a numeric to a Java long
addFinalizerToLast
Modifies .Last() to call 'finalizeSession()
capture.Verbose
Captures output of a function
Java$asShort
Converts a numeric to a Java short
Assert
The Assert class
GString
Character string with advanced substitutions
cmdArgsCall
Calls an R function passing command-line arguments
Java
Static class for Java related methods
captureOutput
Evaluate an R expression and captures the output
colClasses
Creates a vector of column classes used for tabular reading
downloadFile.character
Downloads a file
Options
The Options class
draw.density
Draws a density curve
exit.Verbose
Writes a message and unindents the following output
convertComment.SmartComments
Converts a single smart comment to R code
ProgressBar
Provides text based counting progress bar
compressFile
Compressing and decompressing files
convertComment.VComments
Converts a verbose comment to R code
displayCode
Displays the contents of a text file with line numbers and more
as.character.GString
Gets the processed character string
extract.array
Extract a subset of an array, matrix or a vector with unknown dimensions
compressPDF
Compresses a PDF (into a new PDF)
GString$getBuiltinOs
Gets the operating system of the running machine
GString$getBuiltinPid
Gets the process id of the current R session
System$currentTimeMillis
Get the current time in milliseconds
doCall
Executes a function call with option to ignore unused arguments
as.character.Options
Returns a character string version of this object
dataFrame
Allocates a data frame with given column classes
eget
Gets a variable by name
format.binmode
Converts a binary/octal/hexadecimal number into a string
egsub
Global substitute of expression using regular expressions
callHooks.function
Call hook functions
gcDLLs
Identifies and removes DLLs of packages already unloaded
capitalize
Capitalizes/decapitalizes each character string in a vector
getMessage.TimeoutException
Gets the message of the exception
Arguments$getInstanceOf
Gets an instance of the object that is of a particular class
FileProgressBar
A progress bar that sets the size of a file accordingly
System
Static class to query information about the system
Arguments$getIntegers
Coerces to a integer vector and validates
getTimestampFormat.Verbose
Gets the default timestamp format
System$getUsername
Retrieves the name of the user running R
inAnyInterval.numeric
Checks if a set of values are inside one or more intervals
equals.Options
Checks if this object is equal to another Options object
equals.Verbose
Checks if this object is equal to another
cat.Verbose
Concatenates and prints objects if above threshold
Arguments$getNumerics
Coerces to a numeric vector and validates
gcat
Parses, evaluates and outputs a GString
increase.ProgressBar
Increases (steps) progress bar
isOn.NullVerbose
Checks if the output is on
TextStatusBar
A status bar at the R prompt that can be updated
getRelativePath
Gets the relative pathname relative to a directory
as.character.ProgressBar
Gets a string description of the progress bar
isOn.Verbose
Checks if the output is on
isOpen.character
Checks if there is an open connection to a file
as.character.Verbose
Returns a character string version of this object
getAbsolutePath
Gets the absolute pathname string
Assert$check
Static method asserting that a generic condition is true
Java$asByte
Converts a numeric to a Java byte
Java$asInt
Converts an numeric to a Java integer
getBarString.ProgressBar
Gets the progress bar string to be displayed
copyDirectory
Copies a directory
isPackageInstalled
Checks if a package is installed or not
commandArgs
Extract command-line arguments
getThreshold.Verbose
Gets current verbose threshold
hpaste
Concatenating vectors into human-readable strings
compile.SmartComments
Preprocess a vector of code lines
hsize
Convert byte sizes into human-readable byte sizes
countLines
Counts the number of lines in a text file
createFileAtomically
Creates a file atomically
mergeIntervals.numeric
Merges intervals
detachPackage
Detaches packages by name
intervalsToSeq.matrix
Generates a vector of indices from a matrix of intervals
GString$getBuiltinDate
Gets the current date
mkdirs
Creates a directory including any necessary but nonexistent parent directories
System$parseDebian
Parses a string, file or connection for Debian formatted parameters
copyFile
Copies a file atomically
isAbsolutePath
Checks if this pathname is absolute
dimNA< -
Sets the dimension of an object with the option to infer one dimension automatically
file.info2
Extract File Information (acknowledging symbolic file links also on Windows)
fileAccess
Checks the permission of a file or a directory
System$findGraphicsDevice
Searches for a working PNG device
isPackageLoaded
Checks if a package is loaded or not
Settings$findSettings
Searches for the settings file in one or several directories
isReplicated
Identifies all entries with replicated values
GString$getBuiltinRhome
Gets the path where R is installed
GString$getBuiltinRversion
Gets the current R version
getLabel.TextStatusBar
Gets the current value of a label
Arguments$getEnvironment
Gets an existing environment
Non-documented objects
Non-documented objects
filePath
Construct the path to a file from components and expands Windows Shortcuts along the pathname from root to leaf
patchCode
Patches installed and loaded packages and more
finalizeSession
Function to call for finalizing the R session
newline.TextStatusBar
Writes a newline
promptAndSave.Settings
Prompt user to save modified settings
findSourceTraceback
Finds all 'srcfile' objects generated by source() in all call frames
Arguments$getFilename
Gets and validates a filename
getOption.Options
Gets an option
getLeaves.Options
Gets all (non-list) options in a flat list
flush.TextStatusBar
Flushes the output
newline.Verbose
Writes one or several empty lines
GString$getBuiltinTime
Gets the current time
NullVerbose
A Verbose class ignoring everything
pushBackupFile
Appends a backup suffix to the pathname
GString$getBuiltinUsername
Gets the username of the user running R
Arguments$getReadablePathnames
Gets a readable pathname
TimeoutException
TimeoutException represents timeout errors
Arguments$getRegularExpression
Gets a valid regular expression pattern
GString$getVariableValue
Gets a variable value given a name and attributes
Java$readByte
Reads a Java formatted byte (8 bits) from a connection
Arguments$getCharacters
Coerces to a character vector and validates
resample
Sample values from a set of elements
reset.ProgressBar
Reset progress bar
Java$readInt
Reads a Java formatted int (32 bits) from a connection
setOption
Sets a option in R
Arguments$getDoubles
Coerces to a double vector and validates
getParent
Gets the string of the parent specified by this pathname
setMaxValue.ProgressBar
Sets maximum value
VComments
The VComments class
gstring
Parses and evaluates a GString into a regular string
as.list.Options
Gets a list representation of the options
as.logical.Verbose
Gets a logical value of this object
Arguments$getVector
Validates a vector
attachLocally.list
Assigns an objects elements locally
getRaw.GString
Gets the unprocessed GString
hasOption.Options
Checks if an option exists
setProgress.ProgressBar
Sets current progress
sourceDirectory
Sources files recursively to either local or global environment
sourceTo
Parses and evaluates code from a file or a connection
callHooks
Call hook functions by hook name
setOption.Options
Sets an option
Arguments$getReadablePathname
Gets a readable pathname
Assert$inheritsFrom
Static method asserting that an object inherits from of a certain class
installPackages
Install R packages by name or URL
intToBin
Converts an integer to a binary/octal/hexadecimal number
Arguments$getVerbose
Coerces to Verbose object
isDirectory
Checks if the file specification is a directory
cleanup.FileProgressBar
Removes the progress file for a file progress bar
touchFile
Updates the timestamp of a file
insert
Insert values to a vector at certain positions
Arguments$getWritablePathname
Gets a writable pathname
unwrap.array
Unwrap an array, matrix or a vector to an array of more dimensions
mapToIntervals.numeric
Maps values to intervals
hasUrlProtocol
Checks if one or several pathnames has a URL protocol
header.Verbose
Writes a header
setTicks.ProgressBar
Sets values for which ticks should be visible
Assert$isScalar
Static method asserting that an object is a single value
isSingle
Identifies all entries that exists exactly once
withSink
Evaluate an R expression while temporarily diverting output
less.Verbose
Creates a cloned instance with a higher threshold
Assert$isMatrix
Static method asserting that an object is a matrix
writeRaw.Verbose
Writes objects if above threshold
cmdArgs
Simple access to parsed command-line arguments
listDirectory
Gets the file names in the directory
setTimestampFormat.Verbose
Sets the default timestamp format
isDone.ProgressBar
Checks if progress bar is completed
isZero
Checks if a value is (close to) zero or not
setStepLength.ProgressBar
Sets default step length
createLink
Creates a link to a file or a directory
isModified.Settings
Checks if settings has been modified compared to whats on file
lastModified
Gets the time when the file was last modified
readBinFragments
Reads binary data from disjoint sections of a connection or a file
withTimeout
Evaluate an R expression and interrupts it if it takes too long
nullfile
Gets the pathname or a connection to the NULL device on the current platform
createWindowsShortcut
Creates a Microsoft Windows Shortcut (.lnk file)
isUrl
Checks if one or several pathnames is URLs
Java$writeInt
Writes a integer (32 bits) to a connection in Java format
names.Options
Gets the full pathname of all (non-list) options
Assert$isVector
Static method asserting that an object is a vector
enter.Verbose
Writes a message and indents the following output
loadToEnv
Method to load objects to a new environment
off.Verbose
Turn off the output
env
Creates a new environment, evaluates an expression therein, and returns the environment
writeRaw.MultiVerbose
Writes to each of the Verbose objects
ruler.Verbose
Writes a ruler
tempvar
Gets a unique non-existing temporary variable name
Java$readUTF
Reads a Java (UTF-8) formatted string from a connection
evaluate.GString
Parses and evaluates a GString
evaluate.Verbose
Evaluates a function and prints its results if above threshold
findFiles
Finds one or several files in multiple directories
System$findGhostscript
Searches for a Ghostview executable on the current system
reset.SmartComments
Resets a SmartComments compiler
GString$getBuiltinDatetime
Gets the current date and time
Java$writeUTF
Writes a string to a connection in Java format (UTF-8)
timestamp.Verbose
Writes a timestamp
parse.GString
Parses a GString
more.Verbose
Creates a cloned instance with a lower threshold
setThreshold.Verbose
Sets verbose threshold
nbrOfOptions.Options
Gets the number of options set
on.Verbose
Turn on the output
parse.SmartComments
Parses one single smart comment
mout
Miscellaneous functions for outputting via message()
reset.VComments
Resets a VComments compiler
onGarbageCollect
Registers a function to be called when the R garbage collector is (detected to be) running
queryRCmdCheck
Gets the on R CMD check if the current R session was launched by it
popBackupFile
Drops a backup suffix from the backup pathname
GString$getBuiltinHostname
Gets the hostname of the system running R
popMessage.TextStatusBar
Adds a message above the status bar
shell.exec2
Open a file or URL using Windows File Associations
System$getHostname
Retrieves the computer name of the current host
pushState.Verbose
Pushes the current indentation state of the Verbose object
printf
C-style formatted output
printf.Verbose
Formats and prints object if above threshold
Arguments$getIndices
Coerces to a integer vector and validates
popTemporaryFile
Drops a temporary suffix from the temporary pathname
pushTemporaryFile
Appends a temporary suffix to the pathname
readTable
Reads a file in table format
readWindowsShortcut
Reads a Microsoft Windows Shortcut (.lnk file)
writeRaw.NullVerbose
All output methods
readWindowsShellLink
Reads a Microsoft Windows Shortcut (.lnk file)
seqToHumanReadable
Gets a short human readable string representation of an vector of indices
setDefaultLevel.Verbose
Sets the current default verbose level
print.GString
Prints the processed GString
use
Attaches or loads packages
getLoadedPathname.Settings
Gets the pathname of the settings file loaded
setValue.ProgressBar
Sets current value
Arguments$getLogicals
Coerces to a logical vector and validates
useRepos
Sets package repositories
updateLabels.TextStatusBar
Sets the new values of given labels and updates the status bar
readTableIndex
Reads a single column from file in table format
isEof.connection
Checks if the current file position for a connection is at the 'End of File'
reassignInPackage
Re-assigns a new value to an existing object in a loaded package
swapXY.density
Swaps x and y coordinates of a density object
readRdHelp
Reads one or more Rd help files in a certain format
saveObject
Saves an object to a file or a connection
setLabel.TextStatusBar
Sets the value of a label
isFile
Checks if the file specification is a file
onSessionExit
Registers a function to be called when the R session finishes
isVisible.NullVerbose
Checks if a certain verbose level will be shown or not
saveAnywhere.Settings
Saves settings to file
timestampOn.Verbose
Turns automatic timestamping on and off
update.ProgressBar
Updates progress bar
setLabels.TextStatusBar
Sets new values of given labels
validate.SmartComments
Validates the compiled lines
isVisible.Verbose
Checks if a certain verbose level will be shown or not
systemR
Launches another R process from within R
withRepos
Evaluate an R expression with repositories set temporarily
withCapture
Evaluates an expression and captures the code and/or the output
withSeed
Evaluate an R expression with a temporarily set random set
validate.VComments
Validates the compiled lines
subplots
Creates a grid of subplots
loadAnywhere.Settings
Loads settings from file
summary.Verbose
Generates a summary of an object if above threshold
whichVector.logical
Identifies TRUE elements in a logical vector
Java$writeShort
Writes a short (16 bits) to a connection in Java format
toCamelCase
Converts a string of words into a merged camel-cased word
loadObject
Method to load object from a file or a connection
wrap.array
Reshape an array or a matrix by permuting and/or joining dimensions
tmpfile
Creates a temporary file with content
toUrl
Converts a pathname into a URL
withLocale
Evaluate an R expression with locale set temporarily
moveInSearchPath
Moves a environment in the search path to another position
mpager
A \"pager\" function that outputs to standard error
seqToIntervals
Gets all contiguous intervals of a vector of indices
writeBinFragments
Writes binary data to disjoint sections of a connection or a file
update.FileProgressBar
Updates file progress bar
System$openBrowser
Opens an HTML document using the OS default HTML browser
Java$writeByte
Writes a byte (8 bits) to a connection in Java format
print.Verbose
Prints objects if above threshold
printWarnings.Verbose
Outputs any warnings recorded
Java$readShort
Reads a Java formatted short (16 bits) from a connection
removeDirectory
Removes a directory
renameFile
Renames a file (or a directory) atomically/safely
str.Options
Prints the structure of the options
update.TextStatusBar
Updates the status bar (visually)
splitByPattern
Splits a single character string by pattern
stext
Writes text in the margin along the sides of a plot
str.Verbose
Prints the structure of an object if above threshold
withOptions
Evaluate an R expression with options set temporarily
writeDataFrame.data.frame
Writes a data.frame to tabular text file