Learn R Programming

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

R.utils (version 2.0.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.0.0

License

LGPL (>= 2.1)

Issues

Pull Requests

Stars

Forks

Last Published

March 1st, 2015

Functions in R.utils (2.0.0)

as.character.binmode

Converts a binary/octal/hexadecimal number into a string
Java$asShort

Converts a numeric to a Java short
copyDirectory

Copies a directory
getLoadedPathname.Settings

Gets the pathname of the settings file loaded
Arguments$getLogicals

Coerces to a logical vector and validates
FileProgressBar

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

Gets a list of Verbose objects
convertComment.VComments

Converts a verbose comment to R code
createFileAtomically

Creates a file atomically
dataFrame

Allocates a data frame with given column classes
resample

Sample values from a set of elements
withTimeout

Evaluate an R expression and interrupts it if it takes too long
Options

The Options class
Java$asInt

Converts an numeric to a Java integer
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
countLines

Counts the number of lines in a text file
getAbsolutePath

Gets the absolute pathname string
gcat

Parses, evaluates and outputs a GString
isDone.ProgressBar

Checks if progress bar is completed
createWindowsShortcut

Creates a Microsoft Windows Shortcut (.lnk file)
System$findGraphicsDevice

Searches for a working PNG device
isZero

Checks if a value is (close to) zero or not
cat.Verbose

Concatenates and prints objects if above threshold
addFinalizerToLast

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

Call hook functions by hook name
commandArgs

Extract command-line arguments
Arguments$getIndices

Coerces to a integer vector and validates
R.utils-package

Package R.utils
equals.Options

Checks if this object is equal to another Options object
setTicks.ProgressBar

Sets values for which ticks should be visible
Arguments$getInstanceOf

Gets an instance of the object that is of a particular class
Java

Static class for Java related methods
use

Attaches or loads packages
colClasses

Creates a vector of column classes used for tabular reading
as.character.GString

Gets the processed character string
as.character.ProgressBar

Gets a string description of the progress bar
getMessage.TimeoutException

Gets the message of the exception
System$currentTimeMillis

Get the current time in milliseconds
Settings

Class for applicational settings
Arguments$getNumerics

Coerces to a numeric vector and validates
evaluate.GString

Parses and evaluates a GString
as.character.Verbose

Returns a character string version of this object
finalizeSession

Function to call for finalizing the R session
detachPackage

Detaches packages by name
createLink

Creates a link to a file or a directory
Java$writeInt

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

Gets the current date
update.TextStatusBar

Updates the status bar (visually)
GString$getBuiltinHostname

Gets the hostname of the system running R
attachLocally.list

Assigns an objects elements locally
TextStatusBar

A status bar at the R prompt that can be updated
Sys.readlink2

Read File Symbolic Links (also on Windows)
GString$getBuiltinRversion

Gets the current R version
Assert

The Assert class
cleanup.FileProgressBar

Removes the progress file for a file progress bar
Arguments$getDoubles

Coerces to a double vector and validates
MultiVerbose

A Verbose class ignoring everything
captureOutput

Evaluate an R expression and captures the output
getRelativePath

Gets the relative pathname relative to a directory
doCall

Executes a function call with option to ignore unused arguments
Java$asByte

Converts a numeric to a Java byte
copyFile

Copies a file atomically
mapToIntervals.numeric

Maps values to intervals
cmdArgs

Simple access to parsed command-line arguments
capture.Verbose

Captures output of a function
getTimestampFormat.Verbose

Gets the default timestamp format
lastModified

Gets the time when the file was last modified
callHooks.function

Call hook functions
Arguments$getRegularExpression

Gets a valid regular expression pattern
mout

Miscellaneous functions for outputting via message()
draw.density

Draws a density curve
capitalize

Capitalizes/decapitalizes each character string in a vector
exit.Verbose

Writes a message and unindents the following output
readWindowsShellLink

Reads a Microsoft Windows Shortcut (.lnk file)
System$getHostname

Retrieves the computer name of the current host
GString$getVariableValue

Gets a variable value given a name and attributes
saveAnywhere.Settings

Saves settings to file
downloadFile.character

Downloads a file
System$findGhostscript

Searches for a Ghostview executable on the current system
LComments

The LComments class
GString$getBuiltinRhome

Gets the path where R is installed
Arguments$getReadablePathnames

Gets a readable pathname
Arguments$getIntegers

Coerces to a integer vector and validates
isAbsolutePath

Checks if this pathname is absolute
Arguments$getVector

Validates a vector
setDefaultLevel.Verbose

Sets the current default verbose level
Arguments$getReadablePathname

Gets a readable pathname
displayCode

Displays the contents of a text file with line numbers and more
popMessage.TextStatusBar

Adds a message above the status bar
as.character.Options

Returns a character string version of this object
GString$getBuiltinDatetime

Gets the current date and time
NullVerbose

A Verbose class ignoring everything
mpager

A "pager" function that outputs to standard error
setLabels.TextStatusBar

Sets new values of given labels
Arguments

Static class to validate and process arguments
SmartComments

Abstract class SmartComments
Assert$isMatrix

Static method asserting thatan object is a matrix
GString

Character string with advanced substitutions
getParent

Gets the string of the parent specified by this pathname
Arguments$getVerbose

Coerces to Verbose object
arrayIndex

Converts vector indices to array indices
sourceTo

Parses and evaluates code from a file or a connection
Verbose

Class to writing verbose messages to a connection or file
inAnyInterval.numeric

Checks if a set of values are inside one or more intervals
as.logical.Verbose

Gets a logical value of this object
setProgress.ProgressBar

Sets current progress
parse.SmartComments

Parses one single smart comment
Non-documented objects

Non-documented objects
on.Verbose

Turn on the output
as.double.Verbose

Gets a numeric value of this object
sourceDirectory

Sources files recursively to either local or global environment
isPackageInstalled

Checks if a package is installed or not
findFiles

Finds one or several files in multiple directories
enter.Verbose

Writes a message and indents the following output
Assert$check

Static method asserting that a generic condition is true
getThreshold.Verbose

Gets current verbose threshold
readWindowsShortcut

Reads a Microsoft Windows Shortcut (.lnk file)
parse.GString

Parses a GString
splitByPattern

Splits a single character string by pattern
insert

Insert values to a vector at certain positions
setValue.ProgressBar

Sets current value
getOption.Options

Gets an option
Assert$isScalar

Static method asserting thatan object is a single value
Java$writeUTF

Writes a string to a connection in Java format (UTF-8)
newline.Verbose

Writes one or several empty lines
reset.VComments

Resets a VComments compiler
GString$getBuiltinPid

Gets the process id of the current R session
Java$readInt

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

Checks if a certain verbose level will be shown or not
promptAndSave.Settings

Prompt user to save modified settings
readTable

Reads a file in table format
hasOption.Options

Checks if an option exists
setLabel.TextStatusBar

Sets the value of a label
setOption

Sets a option in R
extract.array

Extract a subset of an array, matrix or a vector with unknown dimensions
validate.VComments

Validates the compiled lines
isSingle

Identifies all entries that exists exactly ones
ruler.Verbose

Writes a ruler
file.info2

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

Checks the permission of a file or a directory
evaluate.Verbose

Evaluates a function and prints its results if above threshold
GString$getBuiltinUsername

Gets the username of the user running R
isFile

Checks if the file specification is a file
loadAnywhere.Settings

Loads settings from file
GString$getBuiltinOs

Gets the operating system of the running machine
header.Verbose

Writes a header
convertComment.SmartComments

Converts a single smart comment to R code
isPackageLoaded

Checks if a package is loaded or not
unwrap.array

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

Moves a environment in the search path to another position
setStepLength.ProgressBar

Sets default step length
systemR

Launches another R process from within R
listDirectory

Gets the file names in the directory
eget

Gets a variable by name
onSessionExit

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

Evaluate an R expression with locale set temporarily
withCapture

Evaluates an expression and captures the code and/or the output
flush.TextStatusBar

Flushes the output
newline.TextStatusBar

Writes a newline
isVisible.Verbose

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

Checks if the file specification is a directory
withSink

Evaluate an R expression while temporarily diverting output
Arguments$getEnvironment

Gets an existing environment
System$parseDebian

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

Checks if the current file position for a connection is at the 'End of File'
timestampOn.Verbose

Turns automatic timestamping on and off
readRdHelp

Reads one or more Rd help files in a certain format
Arguments$getCharacters

Coerces to a character vector and validates
loadObject

Method to load object from a file or a connection
off.Verbose

Turn off the output
getLeaves.Options

Gets all (non-list) options in a flat list
increase.ProgressBar

Increases (steps) progress bar
GString$getBuiltinTime

Gets the current time
Settings$findSettings

Searches for the settings file in one or several directories
timestamp.Verbose

Writes a timestamp
hpaste

Concatenating vectors into human-readable strings
System$openBrowser

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

Prints the structure of an object if above threshold
warnings.Verbose

Outputs any warnings recorded
intervalsToSeq.matrix

Generates a vector of indices from a matrix of intervals
Assert$inherits

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

TimeoutException represents timeout errors
ProgressBar

Provides text based counting progress bar
reassignInPackage

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

Drops a backup suffix from the backup pathname
update.FileProgressBar

Updates file progress bar
isOn.Verbose

Checks if the output is on
isReplicated

Identifies all entries with replicated values
withSeed

Evaluate an R expression with a temporarily set random set
useRepos

Sets package repositories
wrap.array

Reshape an array or a matrix by permuting and/or joining dimensions
isOpen.character

Checks if there is an open connection to a file
writeBinFragments

Writes binary data to disjoint sections of a connection or a file
Arguments$getFilename

Gets and validates a filename
onGarbageCollect

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

Preprocess a vector of code lines
writeDataFrame.data.frame

Writes a data.frame to tabular text file
System$getUsername

Retrieves the name of the user running R
Java$readByte

Reads a Java formatted byte (8 bits) from a connection
dimNA< -

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

Reads a single column from file in table format
print.Verbose

Prints objects if above threshold
pushState.Verbose

Pushes the current indentation state of the Verbose object
reset.SmartComments

Resets a SmartComments compiler
hasUrlProtocol

Checks if one or several pathnames has a URL protocol
isUrl

Checks if one or several pathnames is URLs
shell.exec2

Open a file or URL using Windows File Associations
mergeIntervals.numeric

Merges intervals
toUrl

Converts a pathname into a URL
printf.Verbose

Formats and prints object if above threshold
whichVector.logical

Identifies TRUE elements in a logical vector
names.Options

Gets the full pathname of all (non-list) options
updateLabels.TextStatusBar

Sets the new values of given labels and updates the status bar
str.Options

Prints the structure of the options
nbrOfOptions.Options

Gets the number of options set
patchCode

Patches installed and loaded packages and more
removeDirectory

Removes a directory
Arguments$getWritablePathname

Gets a writable pathname
pushBackupFile

Appends a backup suffix to the pathname
installPackages

Install R packages by name or URL
seqToHumanReadable

Gets a short human readable string representation of an vector of indices
isModified.Settings

Checks if settings has been modified compared to whats on file
less.Verbose

Creates a cloned instance with a higher threshold
readBinFragments

Reads binary data from disjoint sections of a connection or a file
update.ProgressBar

Updates progress bar
pushTemporaryFile

Appends a temporary suffix to the pathname
more.Verbose

Creates a cloned instance with a lower threshold
saveObject

Saves an object to a file or a connection
validate.SmartComments

Validates the compiled lines
Assert$isVector

Static method asserting thatan object is a vector
queryRCmdCheck

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

Reset progress bar
System

Static class to query information about the system
print.GString

Prints the processed GString
summary.Verbose

Generates a summary of an object if above threshold
setTimestampFormat.Verbose

Sets the default timestamp format
writeRaw.Verbose

Writes objects if above threshold
renameFile

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

Converts a string of words into a merged camel-cased word
Java$readUTF

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

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

Gets a list representation of the options
Java$writeShort

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

Evaluate an R expression with options set temporarily
tempvar

Gets a unique non-existing temporary variable name
findSourceTraceback

Finds all 'srcfile' objects generated by source() in all call frames
cmdArgsCall

Calls an R function passing command-line arguments
equals.Verbose

Checks if this object is equal to another
compressFile

Compressing and decompressing files
isOn.NullVerbose

Checks if the output is on
getBarString.ProgressBar

Gets the progress bar string to be displayed
getLabel.TextStatusBar

Gets the current value of a label
getRaw.GString

Gets the unprocessed GString
PERCENT< -PERCENT

Assignment operator for delayed assignments
intToBin

Converts an integer to a binary/octal/hexadecimal number
popTemporaryFile

Drops a temporary suffix from the temporary pathname
printf

C-style formatted output
resetWarnings

Resets recorded warnings
setOption.Options

Sets an option
VComments

The VComments class
egsub

Global substitute of expression using regular expressions
seqToIntervals

Gets all contigous intervals of a vector of indices
setThreshold.Verbose

Sets verbose threshold
stext

Writes text in the margin along the sides of a plot
withRepos

Evaluate an R expression with repositories set temporarily
writeRaw.NullVerbose

All output methods
Java$readShort

Reads a Java formatted short (16 bits) from a connection
writeRaw.MultiVerbose

Writes to each of the Verbose objects
loadToEnv

Method to load objects to a new environment
mkdirs

Creates a directory including any necessary but nonexistent parent directories
subplots

Creates a grid of subplots
setMaxValue.ProgressBar

Sets maximum value
swapXY.density

Swaps x and y coordinates of a density object
touchFile

Updates the timestamp of a file
Java$writeByte

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