Learn R Programming

⚠️There's a newer version (2.12.3) of this package.Take me there.

R.utils (version 2.11.0)

Various Programming Utilities

Description

Utility functions useful when programming and developing R packages.

Copy Link

Version

Install

install.packages('R.utils')

Monthly Downloads

191,979

Version

2.11.0

License

LGPL (>= 2.1)

Issues

Pull Requests

Stars

Forks

Last Published

September 26th, 2021

Functions in R.utils (2.11.0)

Non-documented objects

Non-documented objects
GString

Character string with advanced substitutions
Java

Static class for Java related methods
FileProgressBar

A progress bar that sets the size of a file accordingly
MultiVerbose

A Verbose class ignoring everything
NullVerbose

A Verbose class ignoring everything
Options

The Options class
LComments

The LComments class
Assert

The Assert class
System

Static class to query information about the system
Settings

Class for applicational settings
Arguments

Static class to validate and process arguments
Sys.readlink2

Read File Symbolic Links (also on Windows)
addFinalizerToLast

Modifies .Last() to call 'finalizeSession()
ProgressBar

Provides text based counting progress bar
VComments

The VComments class
Verbose

Class to writing verbose messages to a connection or file
TextStatusBar

A status bar at the R prompt that can be updated
R.utils-package

Package R.utils
SmartComments

Abstract class SmartComments
as.double.Verbose

Gets a numeric value of this object
as.list.MultiVerbose

Gets a list of Verbose objects
as.character.ProgressBar

Gets a string description of the progress bar
as.character.Options

Returns a character string version of this object
Java$asInt

Converts an numeric to a Java integer
as.character.Verbose

Returns a character string version of this object
compressPDF

Compresses a PDF (into a new PDF)
capture.Verbose

Captures output of a function
as.list.Options

Gets a list representation of the options
capitalize

Capitalizes/decapitalizes each character string in a vector
Java$asLong

Converts a numeric to a Java long
createFileAtomically

Creates a file atomically
callHooks

Call hook functions by hook name
dataFrame

Allocates a data frame with given column classes
createLink

Creates a link to a file or a directory
convertComment.SmartComments

Converts a single smart comment to R code
equals.Options

Checks if this object is equal to another Options object
equals.Verbose

Checks if this object is equal to another
Assert$check

Static method asserting that a generic condition is true
env

Creates a new environment, evaluates an expression therein, and returns the environment
detachPackage

Detaches packages by name
System$findGhostscript

Searches for a Ghostview executable on the current system
cleanup.FileProgressBar

Removes the progress file for a file progress bar
gcDLLs

Identifies and removes DLLs of packages already unloaded
gcat

Parses, evaluates and outputs a GString
cmdArgs

Simple access to parsed command-line arguments
callHooks.function

Call hook functions
as.character.GString

Gets the processed character string
GString$getBuiltinDate

Gets the current date
evaluate.GString

Parses and evaluates a GString
copyDirectory

Copies a directory
TimeoutException

TimeoutException represents timeout errors
convertComment.VComments

Converts a verbose comment to R code
GString$getBuiltinDatetime

Gets the current date and time
System$findGraphicsDevice

Searches for a working PNG device
getParent

Gets the string of the parent specified by this pathname
getRaw.GString

Gets the unprocessed GString
Arguments$getWritablePathname

Gets a writable pathname
createWindowsShortcut

Creates a Microsoft Windows Shortcut (.lnk file)
cmdArgsCall

Calls an R function passing command-line arguments
System$currentTimeMillis

Get the current time in milliseconds
draw.density

Draws a density curve
doCall

Executes a function call with option to ignore unused arguments
colClasses

Creates a vector of column classes used for tabular reading
captureOutput

Evaluate an R expression and captures the output
cat.Verbose

Concatenates and prints objects if above threshold
Arguments$getDoubles

Coerces to a double vector and validates
as.logical.Verbose

Gets a logical value of this object
Arguments$getLogicals

Coerces to a logical vector and validates
Arguments$getEnvironment

Gets an existing environment
System$getUsername

Retrieves the name of the user running R
getMessage.TimeoutException

Gets the message of the exception
GString$getVariableValue

Gets a variable value given a name and attributes
Java$asByte

Converts a numeric to a Java byte
Java$asShort

Converts a numeric to a Java short
isSingle

Identifies all entries that exists exactly once
gstring

Parses and evaluates a GString into a regular string
isUrl

Checks if one or several pathnames is URLs
inAnyInterval.numeric

Checks if a set of values are inside one or more intervals
hsize

Convert byte sizes into human-readable byte sizes
copyFile

Copies a file atomically
commandArgs

Extract command-line arguments
eget

Gets a variable by name
downloadFile.character

Downloads a file
listDirectory

Gets the file names in the directory
filePath

Construct the path to a file from components and expands Windows Shortcuts along the pathname from root to leaf
fileAccess

Checks the permission of a file or a directory
egsub

Global substitute of expression using regular expressions
compile.SmartComments

Preprocess a vector of code lines
flush.TextStatusBar

Flushes the output
enter.Verbose

Writes a message and indents the following output
findFiles

Finds one or several files in multiple directories
compressFile

Compressing and decompressing files
finalizeSession

Function to call for finalizing the R session
countLines

Counts the number of lines in a text file
attachLocally.list

Assigns an objects elements locally
GString$getBuiltinUsername

Gets the username of the user running R
Settings$findSettings

Searches for the settings file in one or several directories
format.binmode

Converts a binary/octal/hexadecimal number into a string
file.info2

Extract File Information (acknowledging symbolic file links also on Windows)
findSourceTraceback

Finds all 'srcfile' objects generated by source() in all call frames
isDone.ProgressBar

Checks if progress bar is completed
extract.array

Extract a subset of an array, matrix or a vector with unknown dimensions
isEof.connection

Checks if the current file position for a connection is at the 'End of File'
isReplicated

Identifies all entries with replicated values
GString$getBuiltinHostname

Gets the hostname of the system running R
Arguments$getFilename

Gets and validates a filename
installPackages

Install R packages by name or URL
loadAnywhere.Settings

Loads settings from file
insert

Insert values to a vector at certain positions
Arguments$getReadablePathname

Gets a readable pathname
Arguments$getReadablePathnames

Gets a readable pathname
System$getHostname

Retrieves the computer name of the current host
GString$getBuiltinOs

Gets the operating system of the running machine
mout

Miscellaneous functions for outputting via message()
getLoadedPathname.Settings

Gets the pathname of the settings file loaded
getLeaves.Options

Gets all (non-list) options in a flat list
GString$getBuiltinTime

Gets the current time
Arguments$getCharacters

Coerces to a character vector and validates
GString$getBuiltinRversion

Gets the current R version
moveInSearchPath

Moves a environment in the search path to another position
Assert$isScalar

Static method asserting that an object is a single value
lastModified

Gets the time when the file was last modified
isZero

Checks if a value is (close to) zero or not
isOpen.character

Checks if there is an open connection to a file
dimNA< -

Sets the dimension of an object with the option to infer one dimension automatically
isOn.Verbose

Checks if the output is on
getAbsolutePath

Gets the absolute pathname string
displayCode

Displays the contents of a text file with line numbers and more
exit.Verbose

Writes a message and unindents the following output
isVisible.Verbose

Checks if a certain verbose level will be shown or not
evaluate.Verbose

Evaluates a function and prints its results if above threshold
mkdirs

Creates a directory including any necessary but nonexistent parent directories
Arguments$getIndices

Coerces to a integer vector and validates
Arguments$getInstanceOf

Gets an instance of the object that is of a particular class
Arguments$getRegularExpression

Gets a valid regular expression pattern
popMessage.TextStatusBar

Adds a message above the status bar
getOption.Options

Gets an option
Arguments$getNumerics

Coerces to a numeric vector and validates
popTemporaryFile

Drops a temporary suffix from the temporary pathname
pushBackupFile

Appends a backup suffix to the pathname
mpager

A \"pager\" function that outputs to standard error
promptAndSave.Settings

Prompt user to save modified settings
more.Verbose

Creates a cloned instance with a lower threshold
names.Options

Gets the full pathname of all (non-list) options
onGarbageCollect

Registers a function to be called when the R garbage collector is (detected to be) running
getBarString.ProgressBar

Gets the progress bar string to be displayed
printf

C-style formatted output
less.Verbose

Creates a cloned instance with a higher threshold
readTableIndex

Reads a single column from file in table format
reset.SmartComments

Resets a SmartComments compiler
readTable

Reads a file in table format
printf.Verbose

Formats and prints object if above threshold
reset.VComments

Resets a VComments compiler
onSessionExit

Registers a function to be called when the R session finishes
hasOption.Options

Checks if an option exists
reassignInPackage

Re-assigns a new value to an existing object in a loaded package
readWindowsShortcut

Reads a Microsoft Windows Shortcut (.lnk file)
GString$getBuiltinRhome

Gets the path where R is installed
setMaxValue.ProgressBar

Sets maximum value
setOption.Options

Sets an option
GString$getBuiltinPid

Gets the process id of the current R session
hasUrlProtocol

Checks if one or several pathnames has a URL protocol
splitByPattern

Splits a single character string by pattern
setDefaultLevel.Verbose

Sets the current default verbose level
seqToIntervals

Gets all contiguous intervals of a vector of indices
Arguments$getIntegers

Coerces to a integer vector and validates
print.GString

Prints the processed GString
setTicks.ProgressBar

Sets values for which ticks should be visible
print.Verbose

Prints objects if above threshold
saveAnywhere.Settings

Saves settings to file
ruler.Verbose

Writes a ruler
tmpfile

Creates a temporary file with content
timestampOn.Verbose

Turns automatic timestamping on and off
seqToHumanReadable

Gets a short human readable string representation of an vector of indices
validate.SmartComments

Validates the compiled lines
setTimestampFormat.Verbose

Sets the default timestamp format
setLabel.TextStatusBar

Sets the value of a label
saveObject

Saves an object to a file or a connection
Arguments$getVerbose

Coerces to Verbose object
getRelativePath

Gets the relative pathname relative to a directory
Arguments$getVector

Validates a vector
validate.VComments

Validates the compiled lines
withLocale

Evaluate an R expression with locale set temporarily
isAbsolutePath

Checks if this pathname is absolute
header.Verbose

Writes a header
setLabels.TextStatusBar

Sets new values of given labels
Java$writeByte

Writes a byte (8 bits) to a connection in Java format
subplots

Creates a grid of subplots
hpaste

Concatenating vectors into human-readable strings
writeBinFragments

Writes binary data to disjoint sections of a connection or a file
increase.ProgressBar

Increases (steps) progress bar
Assert$isMatrix

Static method asserting that an object is a matrix
getLabel.TextStatusBar

Gets the current value of a label
withCapture

Evaluates an expression and captures the code and/or the output
isFile

Checks if the file specification is a file
Assert$inheritsFrom

Static method asserting that an object inherits from of a certain class
stext

Writes text in the margin along the sides of a plot
swapXY.density

Swaps x and y coordinates of a density object
newline.TextStatusBar

Writes a newline
update.FileProgressBar

Updates file progress bar
systemR

Launches another R process from within R
nbrOfOptions.Options

Gets the number of options set
patchCode

Patches installed and loaded packages and more
isDirectory

Checks if the file specification is a directory
getThreshold.Verbose

Gets current verbose threshold
withTimeout

Evaluate an R expression and interrupts it if it takes too long
summary.Verbose

Generates a summary of an object if above threshold
unwrap.array

Unwrap an array, matrix or a vector to an array of more dimensions
getTimestampFormat.Verbose

Gets the default timestamp format
update.ProgressBar

Updates progress bar
popBackupFile

Drops a backup suffix from the backup pathname
touchFile

Updates the timestamp of a file
isVisible.NullVerbose

Checks if a certain verbose level will be shown or not
Assert$isVector

Static method asserting that an object is a vector
withSink

Evaluate an R expression while temporarily diverting output
withSeed

Evaluate an R expression with a temporarily set random set
intervalsToSeq.matrix

Generates a vector of indices from a matrix of intervals
wrap.array

Reshape an array or a matrix by permuting and/or joining dimensions
intToBin

Converts an integer to a binary/octal/hexadecimal number
Java$writeInt

Writes a integer (32 bits) to a connection in Java format
writeDataFrame.data.frame

Writes a data.frame to tabular text file
isOn.NullVerbose

Checks if the output is on
isModified.Settings

Checks if settings has been modified compared to whats on file
isPackageLoaded

Checks if a package is loaded or not
isPackageInstalled

Checks if a package is installed or not
loadToEnv

Method to load objects to a new environment
newline.Verbose

Writes one or several empty lines
pushState.Verbose

Pushes the current indentation state of the Verbose object
loadObject

Method to load object from a file or a connection
pushTemporaryFile

Appends a temporary suffix to the pathname
nullfile

Gets the pathname or a connection to the NULL device on the current platform
Java$readUTF

Reads a Java (UTF-8) formatted string from a connection
setOption

Sets a option in R
setProgress.ProgressBar

Sets current progress
parse.SmartComments

Parses one single smart comment
setValue.ProgressBar

Sets current value
readWindowsShellLink

Reads a Microsoft Windows Shortcut (.lnk file)
shell.exec2

Open a file or URL using Windows File Associations
update.TextStatusBar

Updates the status bar (visually)
System$parseDebian

Parses a string, file or connection for Debian formatted parameters
updateLabels.TextStatusBar

Sets the new values of given labels and updates the status bar
mergeIntervals.numeric

Merges intervals
withOptions

Evaluate an R expression with options set temporarily
mapToIntervals.numeric

Maps values to intervals
writeRaw.MultiVerbose

Writes to each of the Verbose objects
off.Verbose

Turn off the output
withRepos

Evaluate an R expression with repositories set temporarily
Java$readByte

Reads a Java formatted byte (8 bits) from a connection
Java$readInt

Reads a Java formatted int (32 bits) from a connection
writeRaw.NullVerbose

All output methods
on.Verbose

Turn on the output
resample

Sample values from a set of elements
reset.ProgressBar

Reset progress bar
setStepLength.ProgressBar

Sets default step length
setThreshold.Verbose

Sets verbose threshold
parse.GString

Parses a GString
str.Options

Prints the structure of the options
System$openBrowser

Opens an HTML document using the OS default HTML browser
queryRCmdCheck

Gets the on R CMD check if the current R session was launched by it
readBinFragments

Reads binary data from disjoint sections of a connection or a file
toCamelCase

Converts a string of words into a merged camel-cased word
str.Verbose

Prints the structure of an object if above threshold
readRdHelp

Reads one or more Rd help files in a certain format
removeDirectory

Removes a directory
Java$readShort

Reads a Java formatted short (16 bits) from a connection
renameFile

Renames a file (or a directory) atomically/safely
useRepos

Sets package repositories
toUrl

Converts a pathname into a URL
use

Attaches or loads packages
Java$writeUTF

Writes a string to a connection in Java format (UTF-8)
sourceDirectory

Sources files recursively to either local or global environment
sourceTo

Parses and evaluates code from a file or a connection
whichVector.logical

Identifies TRUE elements in a logical vector
tempvar

Gets a unique non-existing temporary variable name
timestamp.Verbose

Writes a timestamp
warnings.Verbose

Outputs any warnings recorded
writeRaw.Verbose

Writes objects if above threshold
Java$writeShort

Writes a short (16 bits) to a connection in Java format