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