Learn R Programming

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

R.utils (version 2.4.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.4.0

License

LGPL (>= 2.1)

Issues

Pull Requests

Stars

Forks

Last Published

September 14th, 2016

Functions in R.utils (2.4.0)

as.character.binmode

Converts a binary/octal/hexadecimal number into a string
as.character.Verbose

Returns a character string version of this object
as.character.ProgressBar

Gets a string description of the progress bar
Arguments

Static class to validate and process arguments
addFinalizerToLast

Modifies .Last() to call 'finalizeSession()
as.list.MultiVerbose

Gets a list of Verbose objects
arrayIndex

Converts vector indices to array indices
as.double.Verbose

Gets a numeric value of this object
as.character.GString

Gets the processed character string
as.character.Options

Returns a character string version of this object
callHooks.function

Call hook functions
Java$asLong

Converts a numeric to a Java long
attachLocally.list

Assigns an objects elements locally
Java$asShort

Converts a numeric to a Java short
as.list.Options

Gets a list representation of the options
Java$asInt

Converts an numeric to a Java integer
Java$asByte

Converts a numeric to a Java byte
Assert

The Assert class
callHooks

Call hook functions by hook name
as.logical.Verbose

Gets a logical value of this object
capitalize

Capitalizes/decapitalizes each character string in a vector
cleanup.FileProgressBar

Removes the progress file for a file progress bar
capture.Verbose

Captures output of a function
captureOutput

Evaluate an R expression and captures the output
colClasses

Creates a vector of column classes used for tabular reading
cat.Verbose

Concatenates and prints objects if above threshold
cmdArgsCall

Calls an R function passing command-line arguments
commandArgs

Extract command-line arguments
cmdArgs

Simple access to parsed command-line arguments
Assert$check

Static method asserting that a generic condition is true
countLines

Counts the number of lines in a text file
compile.SmartComments

Preprocess a vector of code lines
compressPDF

Compresses a PDF (into a new PDF)
createLink

Creates a link to a file or a directory
compressFile

Compressing and decompressing files
convertComment.SmartComments

Converts a single smart comment to R code
createFileAtomically

Creates a file atomically
copyFile

Copies a file atomically
convertComment.VComments

Converts a verbose comment to R code
copyDirectory

Copies a directory
createWindowsShortcut

Creates a Microsoft Windows Shortcut (.lnk file)
draw.density

Draws a density curve
System$currentTimeMillis

Get the current time in milliseconds
dimNA< -

Sets the dimension of an object with the option to infer one dimension autmatically
eget

Gets a variable by name
dataFrame

Allocates a data frame with given column classes
displayCode

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

Executes a function call with option to ignore unused arguments
detachPackage

Detaches packages by name
downloadFile.character

Downloads a file
egsub

Global substitute of expression using regular expressions
enter.Verbose

Writes a message and indents the following output
exit.Verbose

Writes a message and unindents the following output
evaluate.Verbose

Evaluates a function and prints its results if above threshold
gcat

Parses, evaluates and outputs a GString
System$findGraphicsDevice

Searches for a working PNG device
Settings$findSettings

Searches for the settings file in one or several directories
gcDLLs

Identifies and removes DLLs of packages already unloaded
Arguments$getDoubles

Coerces to a double vector and validates
Arguments$getEnvironment

Gets an existing environment
Arguments$getLogicals

Coerces to a logical vector and validates
env

Creates a new environment, evaluates an expression therein, and returns the environment
getMessage.TimeoutException

Gets the message of the exception
equals.Options

Checks if this object is equal to another Options object
getParent

Gets the string of the parent specified by this pathname
getBarString.ProgressBar

Gets the progress bar string to be displayed
getAbsolutePath

Gets the absolute pathname string
getRaw.GString

Gets the unprocessed GString
getThreshold.Verbose

Gets current verbose threshold
getTimestampFormat.Verbose

Gets the default timestamp format
hpaste

Concatenating vectors into human-readable strings
findFiles

Finds one or several files in multiple directories
hsize

Convert byte sizes into human-readable byte sizes
System$findGhostscript

Searches for a Ghostview executable on the current system
GString$getBuiltinPid

Gets the process id of the current R session
GString$getBuiltinRhome

Gets the path where R is installed
Arguments$getIndices

Coerces to a integer vector and validates
getLeaves.Options

Gets all (non-list) options in a flat list
Arguments$getInstanceOf

Gets an instance of the object that is of a particular class
getLoadedPathname.Settings

Gets the pathname of the settings file loaded
hasUrlProtocol

Checks if one or several pathnames has a URL protocol
header.Verbose

Writes a header
isDirectory

Checks if the file specification is a directory
Assert$isScalar

Static method asserting thatan object is a single value
isDone.ProgressBar

Checks if progress bar is completed
isSingle

Identifies all entries that exists exactly ones
isVisible.Verbose

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

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

Gets the pathname of the NULL device on the current platform
NullVerbose

A Verbose class ignoring everything
System$openBrowser

Opens an HTML document using the OS default HTML browser
Options

The Options class
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
GString$getBuiltinRversion

Gets the current R version
GString$getBuiltinDatetime

Gets the current date and time
GString$getBuiltinDate

Gets the current date
Arguments$getReadablePathname

Gets a readable pathname
GString$getBuiltinTime

Gets the current time
Arguments$getReadablePathnames

Gets a readable pathname
gstring

Character string with advanced substitutions
hasOption.Options

Checks if an option exists
isPackageLoaded

Checks if a package is loaded or not
installPackages

Install R packages by name or URL
isReplicated

Identifies all entries with replicated values
intervalsToSeq.matrix

Generates a vector of indices from a matrix of intervals
mout

Miscellaneous functions for outputting via message()
more.Verbose

Creates a cloned instance with a lower threshold
newline.Verbose

Writes one or several empty lines
Non-documented objects

Non-documented objects
popMessage.TextStatusBar

Adds a message above the status bar
popTemporaryFile

Drops a temporary suffix from the temporary pathname
Java$readShort

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

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

Resets recorded warnings
renameFile

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

Removes a directory
setTimestampFormat.Verbose

Sets the default timestamp format
ruler.Verbose

Writes a ruler
Settings

Class for applicational settings
sourceTo

Parses and evaluates code from a file or a connection
splitByPattern

Splits a single character string by pattern
Assert$inherits

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

Checks if one or several pathnames is URLs
insert

Insert values to a vector at certain positions
loadToEnv

Method to load objects to a new environment
Assert$isVector

Static method asserting thatan object is a vector
off.Verbose

Turn off the output
mapToIntervals.numeric

Maps values to intervals
on.Verbose

Turn on the output
PERCENT< -PERCENT

Assignment operator for delayed assignments ('lazy future')
Sys.readlink2

Read File Symbolic Links (also on Windows)
popBackupFile

Drops a backup suffix from the backup pathname
update.FileProgressBar

Updates file progress bar
unwrap.array

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

Static class to query information about the system
withRepos

Evaluate an R expression with repositories set temporarily
equals.Verbose

Checks if this object is equal to another
withSeed

Evaluate an R expression with a temporarily set random set
evaluate.GString

Parses and evaluates a GString
FileProgressBar

A progress bar that sets the size of a file accordingly
Arguments$getIntegers

Coerces to a integer vector and validates
GString$getBuiltinUsername

Gets the username of the user running R
finalizeSession

Function to call for finalizing the R session
Arguments$getVector

Validates a vector
getLabel.TextStatusBar

Gets the current value of a label
Arguments$getCharacters

Coerces to a character vector and validates
readWindowsShortcut

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

Coerces to Verbose object
reassignInPackage

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

Gets a short human readable string representation of an vector of indices
sourceDirectory

Sources files recursively to either local or global environment
SmartComments

Abstract class SmartComments
seqToIntervals

Gets all contigous intervals of a vector of indices
setTicks.ProgressBar

Sets values for which ticks should be visible
setThreshold.Verbose

Sets verbose threshold
use

Attaches or loads packages
updateLabels.TextStatusBar

Sets the new values of given labels and updates the status bar
pushState.Verbose

Pushes the current indentation state of the Verbose object
pushBackupFile

Appends a backup suffix to the pathname
R.utils-package

Package R.utils
readBinFragments

Reads binary data from disjoint sections of a connection or a file
str.Verbose

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

Sets an option
setOption

Sets a option in R
subplots

Creates a grid of subplots
TextStatusBar

A status bar at the R prompt that can be updated
TimeoutException

TimeoutException represents timeout errors
Verbose

Class to writing verbose messages to a connection or file
warnings.Verbose

Outputs any warnings recorded
Java$writeByte

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

Gets the relative pathname relative to a directory
Arguments$getRegularExpression

Gets a valid regular expression pattern
writeDataFrame.data.frame

Writes a data.frame to tabular text file
Arguments$getWritablePathname

Gets a writable pathname
intToBin

Converts an integer to a binary/octal/hexadecimal number
isOpen.character

Checks if there is an open connection to a file
isAbsolutePath

Checks if this pathname is absolute
isPackageInstalled

Checks if a package is installed or not
lastModified

Gets the time when the file was last modified
Assert$isMatrix

Static method asserting thatan object is a matrix
isFile

Checks if the file specification is a file
isEof.connection

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

Static class for Java related methods
isZero

Checks if a value is (close to) zero or not
isModified.Settings

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

A \"pager\" function that outputs to standard error
moveInSearchPath

Moves a environment in the search path to another position
onGarbageCollect

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

The LComments class
loadObject

Method to load object from a file or a connection
loadAnywhere.Settings

Loads settings from file
MultiVerbose

A Verbose class ignoring everything
System$parseDebian

Parses a string, file or connection for Debian formatted parameters
names.Options

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

C-style formatted output
printf.Verbose

Formats and prints object if above threshold
patchCode

Patches installed and loaded packages and more
Java$readByte

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

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

Reads a Microsoft Windows Shortcut (.lnk file)
Java$readUTF

Reads a Java (UTF-8) formatted string from a connection
setProgress.ProgressBar

Sets current progress
setLabel.TextStatusBar

Sets the value of a label
setDefaultLevel.Verbose

Sets the current default verbose level
systemR

Launches another R process from within R
setStepLength.ProgressBar

Sets default step length
tempvar

Gets a unique non-existing temporary variable name
touchFile

Updates the timestamp of a file
whichVector.logical

Identifies TRUE elements in a logical vector
writeRaw.NullVerbose

All output methods
withCapture

Evaluates an expression and captures the code and/or the output
Java$writeShort

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

Writes objects if above threshold
extract.array

Extract a subset of an array, matrix or a vector with unknown dimensions
Java$writeUTF

Writes a string to a connection in Java format (UTF-8)
file.info2

Extract File Information (acknowledging symbolic file links also on Windows)
flush.TextStatusBar

Flushes the output
findSourceTraceback

Finds all 'srcfile' objects generated by source() in all call frames
GString$getBuiltinHostname

Gets the hostname of the system running R
GString$getBuiltinOs

Gets the operating system of the running machine
Arguments$getFilename

Gets and validates a filename
Arguments$getNumerics

Coerces to a numeric vector and validates
System$getHostname

Retrieves the computer name of the current host
toUrl

Converts a pathname into a URL
getOption.Options

Gets an option
withSink

Evaluate an R expression while temporarily diverting output
onSessionExit

Registers a function to be called when the R session finishes
withTimeout

Evaluate an R expression and interrupts it if it takes too long
print.GString

Prints the processed GString
print.Verbose

Prints objects if above threshold
readTable

Reads a file in table format
readTableIndex

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

Reset progress bar
resample

Sample values from a set of elements
setMaxValue.ProgressBar

Sets maximum value
setLabels.TextStatusBar

Sets new values of given labels
swapXY.density

Swaps x and y coordinates of a density object
summary.Verbose

Generates a summary of an object if above threshold
tmpfile

Creates a temporary file with content
toCamelCase

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

Sets package repositories
validate.SmartComments

Validates the compiled lines
withLocale

Evaluate an R expression with locale set temporarily
Java$writeInt

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

Evaluate an R expression with options set temporarily
writeRaw.MultiVerbose

Writes to each of the Verbose objects
System$getUsername

Retrieves the name of the user running R
GString$getVariableValue

Gets a variable value given a name and attributes
inAnyInterval.numeric

Checks if a set of values are inside one or more intervals
increase.ProgressBar

Increases (steps) progress bar
isOn.Verbose

Checks if the output is on
isOn.NullVerbose

Checks if the output is on
listDirectory

Gets the file names in the directory
less.Verbose

Creates a cloned instance with a higher threshold
mkdirs

Creates a directory including any necessary but nonexistent parent directories
mergeIntervals.numeric

Merges intervals
nbrOfOptions.Options

Gets the number of options set
newline.TextStatusBar

Writes a newline
parse.GString

Parses a GString
parse.SmartComments

Parses one single smart comment
ProgressBar

Provides text based counting progress bar
promptAndSave.Settings

Prompt user to save modified settings
queryRCmdCheck

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

Resets a SmartComments compiler
pushTemporaryFile

Appends a temporary suffix to the pathname
reset.VComments

Resets a VComments compiler
saveAnywhere.Settings

Saves settings to file
saveObject

Saves an object to a file or a connection
setValue.ProgressBar

Sets current value
shell.exec2

Open a file or URL using Windows File Associations
stext

Writes text in the margin along the sides of a plot
timestampOn.Verbose

Turns automatic timestamping on and off
timestamp.Verbose

Writes a timestamp
str.Options

Prints the structure of the options
update.ProgressBar

Updates progress bar
update.TextStatusBar

Updates the status bar (visually)
validate.VComments

Validates the compiled lines
VComments

The VComments class
wrap.array

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

Writes binary data to disjoint sections of a connection or a file