Learn R Programming

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

R.utils (version 2.8.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.8.0

License

LGPL (>= 2.1)

Issues

Pull Requests

Stars

Forks

Last Published

February 14th, 2019

Functions in R.utils (2.8.0)

Arguments

Static class to validate and process arguments
Assert

The Assert class
Settings

Class for applicational settings
SmartComments

Abstract class SmartComments
addFinalizerToLast

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

Converts vector indices to array indices
callHooks

Call hook functions by hook name
as.character.ProgressBar

Gets a string description of the progress bar
callHooks.function

Call hook functions
as.character.Verbose

Returns a character string version of this object
capitalize

Capitalizes/decapitalizes each character string in a vector
colClasses

Creates a vector of column classes used for tabular reading
commandArgs

Extract command-line arguments
compressPDF

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

Captures output of a function
convertComment.SmartComments

Converts a single smart comment to R code
dimNA< -

Sets the dimension of an object with the option to infer one dimension automatically
displayCode

Displays the contents of a text file with line numbers and more
MultiVerbose

A Verbose class ignoring everything
Assert$check

Static method asserting that a generic condition is true
FileProgressBar

A progress bar that sets the size of a file accordingly
cleanup.FileProgressBar

Removes the progress file for a file progress bar
GString

Character string with advanced substitutions
convertComment.VComments

Converts a verbose comment to R code
Non-documented objects

Non-documented objects
copyDirectory

Copies a directory
System$findGhostscript

Searches for a Ghostview executable on the current system
VComments

The VComments class
System$findGraphicsDevice

Searches for a working PNG device
as.character.binmode

Converts a binary/octal/hexadecimal number into a string
Verbose

Class to writing verbose messages to a connection or file
egsub

Global substitute of expression using regular expressions
enter.Verbose

Writes a message and indents the following output
TextStatusBar

A status bar at the R prompt that can be updated
as.double.Verbose

Gets a numeric value of this object
TimeoutException

TimeoutException represents timeout errors
as.logical.Verbose

Gets a logical value of this object
Java$asByte

Converts a numeric to a Java byte
compile.SmartComments

Preprocess a vector of code lines
Arguments$getInstanceOf

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

Coerces to a integer vector and validates
getLoadedPathname.Settings

Gets the pathname of the settings file loaded
fileAccess

Checks the permission of a file or a directory
filePath

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

Compressing and decompressing files
dataFrame

Allocates a data frame with given column classes
Arguments$getLogicals

Coerces to a logical vector and validates
GString$getVariableValue

Gets a variable value given a name and attributes
gcat

Parses, evaluates and outputs a GString
Arguments$getVector

Validates a vector
inAnyInterval.numeric

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

Static class for Java related methods
LComments

The LComments class
as.list.MultiVerbose

Gets a list of Verbose objects
increase.ProgressBar

Increases (steps) progress bar
isOn.NullVerbose

Checks if the output is on
isOn.Verbose

Checks if the output is on
isVisible.NullVerbose

Checks if a certain verbose level will be shown or not
NullVerbose

A Verbose class ignoring everything
ProgressBar

Provides text based counting progress bar
getAbsolutePath

Gets the absolute pathname string
as.list.Options

Gets a list representation of the options
isVisible.Verbose

Checks if a certain verbose level will be shown or not
Java$asInt

Converts an numeric to a Java integer
Options

The Options class
Java$asLong

Converts a numeric to a Java long
detachPackage

Detaches packages by name
equals.Verbose

Checks if this object is equal to another
GString$getBuiltinRhome

Gets the path where R is installed
createFileAtomically

Creates a file atomically
createLink

Creates a link to a file or a directory
Sys.readlink2

Read File Symbolic Links (also on Windows)
doCall

Executes a function call with option to ignore unused arguments
downloadFile.character

Downloads a file
GString$getBuiltinRversion

Gets the current R version
R.utils-package

Package R.utils
System

Static class to query information about the system
as.character.GString

Gets the processed character string
as.character.Options

Returns a character string version of this object
cmdArgs

Simple access to parsed command-line arguments
isZero

Checks if a value is (close to) zero or not
cmdArgsCall

Calls an R function passing command-line arguments
createWindowsShortcut

Creates a Microsoft Windows Shortcut (.lnk file)
evaluate.GString

Parses and evaluates a GString
Java$asShort

Converts a numeric to a Java short
finalizeSession

Function to call for finalizing the R session
System$currentTimeMillis

Get the current time in milliseconds
evaluate.Verbose

Evaluates a function and prints its results if above threshold
extract.array

Extract a subset of an array, matrix or a vector with unknown dimensions
findFiles

Finds one or several files in multiple directories
GString$getBuiltinTime

Gets the current time
attachLocally.list

Assigns an objects elements locally
file.info2

Extract File Information (acknowledging symbolic file links also on Windows)
Arguments$getCharacters

Coerces to a character vector and validates
Settings$findSettings

Searches for the settings file in one or several directories
lastModified

Gets the time when the file was last modified
Arguments$getDoubles

Coerces to a double vector and validates
findSourceTraceback

Finds all 'srcfile' objects generated by source() in all call frames
exit.Verbose

Writes a message and unindents the following output
getMessage.TimeoutException

Gets the message of the exception
more.Verbose

Creates a cloned instance with a lower threshold
mout

Miscellaneous functions for outputting via message()
Arguments$getNumerics

Coerces to a numeric vector and validates
GString$getBuiltinOs

Gets the operating system of the running machine
getRelativePath

Gets the relative pathname relative to a directory
flush.TextStatusBar

Flushes the output
GString$getBuiltinUsername

Gets the username of the user running R
isDirectory

Checks if the file specification is a directory
captureOutput

Evaluate an R expression and captures the output
onSessionExit

Registers a function to be called when the R session finishes
getThreshold.Verbose

Gets current verbose threshold
isDone.ProgressBar

Checks if progress bar is completed
GString$getBuiltinPid

Gets the process id of the current R session
hasUrlProtocol

Checks if one or several pathnames has a URL protocol
loadToEnv

Method to load objects to a new environment
mapToIntervals.numeric

Maps values to intervals
System$getHostname

Retrieves the computer name of the current host
cat.Verbose

Concatenates and prints objects if above threshold
copyFile

Copies a file atomically
countLines

Counts the number of lines in a text file
header.Verbose

Writes a header
Arguments$getIndices

Coerces to a integer vector and validates
nullfile

Gets the pathname or a connection to the NULL device on the current platform
System$openBrowser

Opens an HTML document using the OS default HTML browser
off.Verbose

Turn off the output
gcDLLs

Identifies and removes DLLs of packages already unloaded
printf.Verbose

Formats and prints object if above threshold
Assert$isScalar

Static method asserting that an object is a single value
draw.density

Draws a density curve
Arguments$getReadablePathnames

Gets a readable pathname
isSingle

Identifies all entries that exists exactly once
getBarString.ProgressBar

Gets the progress bar string to be displayed
eget

Gets a variable by name
loadAnywhere.Settings

Loads settings from file
promptAndSave.Settings

Prompt user to save modified settings
env

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

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

Gets the current date
Arguments$getRegularExpression

Gets a valid regular expression pattern
readWindowsShortcut

Reads a Microsoft Windows Shortcut (.lnk file)
Arguments$getVerbose

Coerces to Verbose object
popBackupFile

Drops a backup suffix from the backup pathname
loadObject

Method to load object from a file or a connection
popMessage.TextStatusBar

Adds a message above the status bar
Arguments$getWritablePathname

Gets a writable pathname
popTemporaryFile

Drops a temporary suffix from the temporary pathname
equals.Options

Checks if this object is equal to another Options object
GString$getBuiltinDatetime

Gets the current date and time
saveObject

Saves an object to a file or a connection
installPackages

Install R packages by name or URL
GString$getBuiltinHostname

Gets the hostname of the system running R
intToBin

Converts an integer to a binary/octal/hexadecimal number
getLabel.TextStatusBar

Gets the current value of a label
moveInSearchPath

Moves a environment in the search path to another position
Arguments$getEnvironment

Gets an existing environment
seqToHumanReadable

Gets a short human readable string representation of an vector of indices
str.Options

Prints the structure of the options
Arguments$getFilename

Gets and validates a filename
isEof.connection

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

A \"pager\" function that outputs to standard error
parse.GString

Parses a GString
str.Verbose

Prints the structure of an object if above threshold
getOption.Options

Gets an option
getParent

Gets the string of the parent specified by this pathname
isFile

Checks if the file specification is a file
getTimestampFormat.Verbose

Gets the default timestamp format
System$getUsername

Retrieves the name of the user running R
parse.SmartComments

Parses one single smart comment
isUrl

Checks if one or several pathnames is URLs
getLeaves.Options

Gets all (non-list) options in a flat list
print.GString

Prints the processed GString
print.Verbose

Prints objects if above threshold
hpaste

Concatenating vectors into human-readable strings
Java$readInt

Reads a Java formatted int (32 bits) from a connection
hsize

Convert byte sizes into human-readable byte sizes
getRaw.GString

Gets the unprocessed GString
Arguments$getReadablePathname

Gets a readable pathname
toCamelCase

Converts a string of words into a merged camel-cased word
readRdHelp

Reads one or more Rd help files in a certain format
Assert$isVector

Static method asserting that an object is a vector
reset.VComments

Resets a VComments compiler
printf

C-style formatted output
resetWarnings

Resets recorded warnings
pushBackupFile

Appends a backup suffix to the pathname
gstring

Parses and evaluates a GString into a regular string
setOption

Sets a option in R
toUrl

Converts a pathname into a URL
hasOption.Options

Checks if an option exists
ruler.Verbose

Writes a ruler
writeRaw.Verbose

Writes objects if above threshold
setProgress.ProgressBar

Sets current progress
setValue.ProgressBar

Sets current value
intervalsToSeq.matrix

Generates a vector of indices from a matrix of intervals
pushState.Verbose

Pushes the current indentation state of the Verbose object
Java$readShort

Reads a Java formatted short (16 bits) from a connection
shell.exec2

Open a file or URL using Windows File Associations
Assert$inheritsFrom

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

Checks if this pathname is absolute
isPackageLoaded

Checks if a package is loaded or not
isReplicated

Identifies all entries with replicated values
insert

Insert values to a vector at certain positions
readTable

Reads a file in table format
Java$writeShort

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

Renames a file (or a directory) atomically/safely
less.Verbose

Creates a cloned instance with a higher threshold
resample

Sample values from a set of elements
saveAnywhere.Settings

Saves settings to file
Assert$isMatrix

Static method asserting that an object is a matrix
isModified.Settings

Checks if settings has been modified compared to whats on file
setLabel.TextStatusBar

Sets the value of a label
timestampOn.Verbose

Turns automatic timestamping on and off
listDirectory

Gets the file names in the directory
names.Options

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

Creates a temporary file with content
touchFile

Updates the timestamp of a file
nbrOfOptions.Options

Gets the number of options set
System$parseDebian

Parses a string, file or connection for Debian formatted parameters
seqToIntervals

Gets all contiguous intervals of a vector of indices
isOpen.character

Checks if there is an open connection to a file
mergeIntervals.numeric

Merges intervals
isPackageInstalled

Checks if a package is installed or not
mkdirs

Creates a directory including any necessary but nonexistent parent directories
setDefaultLevel.Verbose

Sets the current default verbose level
patchCode

Patches installed and loaded packages and more
setLabels.TextStatusBar

Sets new values of given labels
setStepLength.ProgressBar

Sets default step length
setTicks.ProgressBar

Sets values for which ticks should be visible
readTableIndex

Reads a single column from file in table format
subplots

Creates a grid of subplots
setTimestampFormat.Verbose

Sets the default timestamp format
setThreshold.Verbose

Sets verbose threshold
summary.Verbose

Generates a summary of an object if above threshold
use

Attaches or loads packages
newline.TextStatusBar

Writes a newline
warnings.Verbose

Outputs any warnings recorded
newline.Verbose

Writes one or several empty lines
on.Verbose

Turn on the output
useRepos

Sets package repositories
Java$readUTF

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

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

Appends a temporary suffix to the pathname
withOptions

Evaluate an R expression with options set temporarily
unwrap.array

Unwrap an array, matrix or a vector to an array of more dimensions
withRepos

Evaluate an R expression with repositories set temporarily
validate.SmartComments

Validates the compiled lines
reset.ProgressBar

Reset progress bar
validate.VComments

Validates the compiled lines
queryRCmdCheck

Gets the on R CMD check if the current R session was launched by it
reset.SmartComments

Resets a SmartComments compiler
setMaxValue.ProgressBar

Sets maximum value
readBinFragments

Reads binary data from disjoint sections of a connection or a file
whichVector.logical

Identifies TRUE elements in a logical vector
withTimeout

Evaluate an R expression and interrupts it if it takes too long
Java$readByte

Reads a Java formatted byte (8 bits) from a connection
setOption.Options

Sets an option
Java$writeUTF

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

Re-assigns a new value to an existing object in a loaded package
wrap.array

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

Removes a directory
writeRaw.MultiVerbose

Writes to each of the Verbose objects
sourceDirectory

Sources files recursively to either local or global environment
sourceTo

Parses and evaluates code from a file or a connection
splitByPattern

Splits a single character string by pattern
stext

Writes text in the margin along the sides of a plot
writeRaw.NullVerbose

All output methods
swapXY.density

Swaps x and y coordinates of a density object
systemR

Launches another R process from within R
update.TextStatusBar

Updates the status bar (visually)
tempvar

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

Writes a timestamp
updateLabels.TextStatusBar

Sets the new values of given labels and updates the status bar
update.FileProgressBar

Updates file progress bar
withSink

Evaluate an R expression while temporarily diverting output
withSeed

Evaluate an R expression with a temporarily set random set
writeBinFragments

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

Updates progress bar
withCapture

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

Evaluate an R expression with locale set temporarily
Java$writeByte

Writes a byte (8 bits) to a connection in Java format
writeDataFrame.data.frame

Writes a data.frame to tabular text file
Java$writeInt

Writes a integer (32 bits) to a connection in Java format