Learn R Programming

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

R.utils (version 2.0.1)

Various Programming Utilities

Description

Utility functions useful when programming and developing R packages.

Copy Link

Version

Install

install.packages('R.utils')

Monthly Downloads

163,892

Version

2.0.1

License

LGPL (>= 2.1)

Issues

Pull Requests

Stars

Forks

Maintainer

Henrik Bengtsson

Last Published

April 26th, 2015

Functions in R.utils (2.0.1)

NullVerbose

A Verbose class ignoring everything
MultiVerbose

A Verbose class ignoring everything
doCall

Executes a function call with option to ignore unused arguments
egsub

Global substitute of expression using regular expressions
findFiles

Finds one or several files in multiple directories
Verbose

Class to writing verbose messages to a connection or file
Sys.readlink2

Read File Symbolic Links (also on Windows)
Java$asByte

Converts a numeric to a Java byte
System$currentTimeMillis

Get the current time in milliseconds
countLines

Counts the number of lines in a text file
as.character.Verbose

Returns a character string version of this object
Arguments$getWritablePathname

Gets a writable pathname
findSourceTraceback

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

The Options class
GString$getBuiltinRversion

Gets the current R version
System$getHostname

Retrieves the computer name of the current host
getLoadedPathname.Settings

Gets the pathname of the settings file loaded
GString

Character string with advanced substitutions
cleanup.FileProgressBar

Removes the progress file for a file progress bar
equals.Options

Checks if this object is equal to another Options object
colClasses

Creates a vector of column classes used for tabular reading
intToBin

Converts an integer to a binary/octal/hexadecimal number
Settings$findSettings

Searches for the settings file in one or several directories
isDirectory

Checks if the file specification is a directory
Arguments$getInstanceOf

Gets an instance of the object that is of a particular class
Assert$check

Static method asserting that a generic condition is true
commandArgs

Extract command-line arguments
convertComment.SmartComments

Converts a single smart comment to R code
fileAccess

Checks the permission of a file or a directory
capitalize

Capitalizes/decapitalizes each character string in a vector
as.character.Options

Returns a character string version of this object
as.double.Verbose

Gets a numeric value of this object
GString$getBuiltinPid

Gets the process id of the current R session
LComments

The LComments class
mpager

A "pager" function that outputs to standard error
getAbsolutePath

Gets the absolute pathname string
eget

Gets a variable by name
as.character.GString

Gets the processed character string
captureOutput

Evaluate an R expression and captures the output
TimeoutException

TimeoutException represents timeout errors
R.utils-package

Package R.utils
Arguments$getNumerics

Coerces to a numeric vector and validates
Arguments

Static class to validate and process arguments
cmdArgs

Simple access to parsed command-line arguments
createWindowsShortcut

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

Draws a density curve
gcat

Parses, evaluates and outputs a GString
extract.array

Extract a subset of an array, matrix or a vector with unknown dimensions
GString$getBuiltinRhome

Gets the path where R is installed
as.character.binmode

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

The Assert class
TextStatusBar

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

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

Writes a message and indents the following output
evaluate.GString

Parses and evaluates a GString
filePath

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

Gets a variable value given a name and attributes
Arguments$getIndices

Coerces to a integer vector and validates
System

Static class to query information about the system
compressFile

Compressing and decompressing files
GString$getBuiltinDatetime

Gets the current date and time
Java$asLong

Converts a numeric to a Java long
isFile

Checks if the file specification is a file
downloadFile.character

Downloads a file
cat.Verbose

Concatenates and prints objects if above threshold
evaluate.Verbose

Evaluates a function and prints its results if above threshold
isUrl

Checks if one or several pathnames is URLs
createLink

Creates a link to a file or a directory
GString$getBuiltinDate

Gets the current date
listDirectory

Gets the file names in the directory
Arguments$getVerbose

Coerces to Verbose object
isOn.Verbose

Checks if the output is on
Arguments$getRegularExpression

Gets a valid regular expression pattern
setOption.Options

Sets an option
Settings

Class for applicational settings
names.Options

Gets the full pathname of all (non-list) options
file.info2

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

Coerces to a logical vector and validates
Arguments$getVector

Validates a vector
PERCENT< -PERCENT

Assignment operator for delayed assignments
ProgressBar

Provides text based counting progress bar
Arguments$getEnvironment

Gets an existing environment
setStepLength.ProgressBar

Sets default step length
promptAndSave.Settings

Prompt user to save modified settings
isSingle

Identifies all entries that exists exactly ones
isOpen.character

Checks if there is an open connection to a file
getTimestampFormat.Verbose

Gets the default timestamp format
mkdirs

Creates a directory including any necessary but nonexistent parent directories
dataFrame

Allocates a data frame with given column classes
hasOption.Options

Checks if an option exists
getMessage.TimeoutException

Gets the message of the exception
finalizeSession

Function to call for finalizing the R session
Arguments$getReadablePathname

Gets a readable pathname
Java$asInt

Converts an numeric to a Java integer
lastModified

Gets the time when the file was last modified
flush.TextStatusBar

Flushes the output
setValue.ProgressBar

Sets current value
isDone.ProgressBar

Checks if progress bar is completed
GString$getBuiltinHostname

Gets the hostname of the system running R
reset.SmartComments

Resets a SmartComments compiler
createFileAtomically

Creates a file atomically
isAbsolutePath

Checks if this pathname is absolute
getBarString.ProgressBar

Gets the progress bar string to be displayed
hasUrlProtocol

Checks if one or several pathnames has a URL protocol
getRaw.GString

Gets the unprocessed GString
setTicks.ProgressBar

Sets values for which ticks should be visible
Java$readInt

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

Registers a function to be called when the R session finishes
GString$getBuiltinOs

Gets the operating system of the running machine
on.Verbose

Turn on the output
Assert$isMatrix

Static method asserting thatan object is a matrix
exit.Verbose

Writes a message and unindents the following output
installPackages

Install R packages by name or URL
sourceTo

Parses and evaluates code from a file or a connection
getParent

Gets the string of the parent specified by this pathname
System$openBrowser

Opens an HTML document using the OS default HTML browser
Java$readShort

Reads a Java formatted short (16 bits) from a connection
header.Verbose

Writes a header
useRepos

Sets package repositories
Arguments$getIntegers

Coerces to a integer vector and validates
GString$getBuiltinUsername

Gets the username of the user running R
isPackageInstalled

Checks if a package is installed or not
Arguments$getCharacters

Coerces to a character vector and validates
as.character.ProgressBar

Gets a string description of the progress bar
readTableIndex

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

Prints the structure of an object if above threshold
cmdArgsCall

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

Generates a summary of an object if above threshold
inAnyInterval.numeric

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

Modifies .Last() to call 'finalizeSession()
mapToIntervals.numeric

Maps values to intervals
loadAnywhere.Settings

Loads settings from file
touchFile

Updates the timestamp of a file
update.FileProgressBar

Updates file progress bar
as.logical.Verbose

Gets a logical value of this object
tempvar

Gets a unique non-existing temporary variable name
isOn.NullVerbose

Checks if the output is on
less.Verbose

Creates a cloned instance with a higher threshold
popMessage.TextStatusBar

Adds a message above the status bar
shell.exec2

Open a file or URL using Windows File Associations
popTemporaryFile

Drops a temporary suffix from the temporary pathname
withSink

Evaluate an R expression while temporarily diverting output
writeRaw.Verbose

Writes objects if above threshold
isZero

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

Writes one or several empty lines
removeDirectory

Removes a directory
withOptions

Evaluate an R expression with options set temporarily
systemR

Launches another R process from within R
writeDataFrame.data.frame

Writes a data.frame to tabular text file
update.ProgressBar

Updates progress bar
GString$getBuiltinTime

Gets the current time
copyFile

Copies a file atomically
moveInSearchPath

Moves a environment in the search path to another position
print.GString

Prints the processed GString
Java$asShort

Converts a numeric to a Java short
timestampOn.Verbose

Turns automatic timestamping on and off
getLeaves.Options

Gets all (non-list) options in a flat list
withSeed

Evaluate an R expression with a temporarily set random set
mergeIntervals.numeric

Merges intervals
resample

Sample values from a set of elements
isVisible.NullVerbose

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

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

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

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

Coerces to a double vector and validates
validate.SmartComments

Validates the compiled lines
printf.Verbose

Formats and prints object if above threshold
Non-documented objects

Non-documented objects
loadObject

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

Pushes the current indentation state of the Verbose object
dimNA< -

Sets the dimension of an object with the option to infer one dimension autmatically
equals.Verbose

Checks if this object is equal to another
print.Verbose

Prints objects if above threshold
SmartComments

Abstract class SmartComments
writeRaw.MultiVerbose

Writes to each of the Verbose objects
pushTemporaryFile

Appends a temporary suffix to the pathname
reset.VComments

Resets a VComments compiler
setThreshold.Verbose

Sets verbose threshold
Java$readByte

Reads a Java formatted byte (8 bits) from a connection
update.TextStatusBar

Updates the status bar (visually)
withCapture

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

Method to load objects to a new environment
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
setTimestampFormat.Verbose

Sets the default timestamp format
newline.TextStatusBar

Writes a newline
mout

Miscellaneous functions for outputting via message()
parse.GString

Parses a GString
onGarbageCollect

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

Gets the number of options set
setMaxValue.ProgressBar

Sets maximum value
Assert$isScalar

Static method asserting thatan object is a single value
hpaste

Concatenating vectors into human-readable strings
more.Verbose

Creates a cloned instance with a lower threshold
setDefaultLevel.Verbose

Sets the current default verbose level
withRepos

Evaluate an R expression with repositories set temporarily
swapXY.density

Swaps x and y coordinates of a density object
renameFile

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

Evaluate an R expression and interrupts it if it takes too long
isEof.connection

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

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

Static class for Java related methods
sourceDirectory

Sources files recursively to either local or global environment
Java$writeInt

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

Writes a string to a connection in Java format (UTF-8)
callHooks.function

Call hook functions
VComments

The VComments class
seqToHumanReadable

Gets a short human readable string representation of an vector of indices
unwrap.array

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

Appends a backup suffix to the pathname
use

Attaches or loads packages
reassignInPackage

Re-assigns a new value to an existing object in a loaded package
capture.Verbose

Captures output of a function
patchCode

Patches installed and loaded packages and more
whichVector.logical

Identifies TRUE elements in a logical vector
toUrl

Converts a pathname into a URL
increase.ProgressBar

Increases (steps) progress bar
warnings.Verbose

Outputs any warnings recorded
intervalsToSeq.matrix

Generates a vector of indices from a matrix of intervals
compile.SmartComments

Preprocess a vector of code lines
off.Verbose

Turn off the output
Assert$isVector

Static method asserting thatan object is a vector
isPackageLoaded

Checks if a package is loaded or not
writeRaw.NullVerbose

All output methods
popBackupFile

Drops a backup suffix from the backup pathname
subplots

Creates a grid of subplots
copyDirectory

Copies a directory
isModified.Settings

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

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

Detaches packages by name
withLocale

Evaluate an R expression with locale set temporarily
readRdHelp

Reads one or more Rd help files in a certain format
System$parseDebian

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

Identifies all entries with replicated values
Java$readUTF

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

Sets a option in R
updateLabels.TextStatusBar

Sets the new values of given labels and updates the status bar
stext

Writes text in the margin along the sides of a plot
System$findGhostscript

Searches for a Ghostview executable on the current system
saveAnywhere.Settings

Saves settings to file
str.Options

Prints the structure of the options
getOption.Options

Gets an option
validate.VComments

Validates the compiled lines
getRelativePath

Gets the relative pathname relative to a directory
wrap.array

Reshape an array or a matrix by permuting and/or joining dimensions
Arguments$getReadablePathnames

Gets a readable pathname
resetWarnings

Resets recorded warnings
printf

C-style formatted output
isVisible.Verbose

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

Splits a single character string by pattern
setProgress.ProgressBar

Sets current progress
getThreshold.Verbose

Gets current verbose threshold
readWindowsShortcut

Reads a Microsoft Windows Shortcut (.lnk file)
seqToIntervals

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

Writes a timestamp
as.list.MultiVerbose

Gets a list of Verbose objects
arrayIndex

Converts vector indices to array indices
callHooks

Call hook functions by hook name
as.list.Options

Gets a list representation of the options
insert

Insert values to a vector at certain positions
attachLocally.list

Assigns an objects elements locally
convertComment.VComments

Converts a verbose comment to R code
System$findGraphicsDevice

Searches for a working PNG device
ruler.Verbose

Writes a ruler
setLabel.TextStatusBar

Sets the value of a label
Arguments$getFilename

Gets and validates a filename
getLabel.TextStatusBar

Gets the current value of a label
Assert$inherits

Static method asserting that an object inherits from of a certain class
System$getUsername

Retrieves the name of the user running R
parse.SmartComments

Parses one single smart comment
reset.ProgressBar

Reset progress bar
saveObject

Saves an object to a file or a connection
setLabels.TextStatusBar

Sets new values of given labels
readTable

Reads a file in table format
Java$writeByte

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

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