Learn R Programming

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

R.utils (version 2.0.2)

Various Programming Utilities

Description

Utility functions useful when programming and developing R packages.

Copy Link

Version

Install

install.packages('R.utils')

Monthly Downloads

137,448

Version

2.0.2

License

LGPL (>= 2.1)

Issues

Pull Requests

Stars

Forks

Last Published

April 27th, 2015

Functions in R.utils (2.0.2)

Settings$findSettings

Searches for the settings file in one or several directories
downloadFile.character

Downloads a file
moveInSearchPath

Moves a environment in the search path to another position
equals.Options

Checks if this object is equal to another Options object
countLines

Counts the number of lines in a text file
increase.ProgressBar

Increases (steps) progress bar
GString$getBuiltinDate

Gets the current date
isSingle

Identifies all entries that exists exactly ones
System$openBrowser

Opens an HTML document using the OS default HTML browser
use

Attaches or loads packages
update.ProgressBar

Updates progress bar
enter.Verbose

Writes a message and indents the following output
cat.Verbose

Concatenates and prints objects if above threshold
System

Static class to query information about the system
saveAnywhere.Settings

Saves settings to file
sourceDirectory

Sources files recursively to either local or global environment
GString

Character string with advanced substitutions
as.list.MultiVerbose

Gets a list of Verbose objects
as.character.ProgressBar

Gets a string description of the progress bar
Arguments

Static class to validate and process arguments
Java$asLong

Converts a numeric to a Java long
as.character.GString

Gets the processed character string
intToBin

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

Detaches packages by name
Arguments$getIntegers

Coerces to a integer vector and validates
copyFile

Copies a file atomically
captureOutput

Evaluate an R expression and captures the output
Non-documented objects

Non-documented objects
evaluate.GString

Parses and evaluates a GString
R.utils-package

Package R.utils
colClasses

Creates a vector of column classes used for tabular reading
getRelativePath

Gets the relative pathname relative to a directory
as.double.Verbose

Gets a numeric value of this object
createLink

Creates a link to a file or a directory
equals.Verbose

Checks if this object is equal to another
GString$getBuiltinTime

Gets the current time
getOption.Options

Gets an option
ProgressBar

Provides text based counting progress bar
Java$asInt

Converts an numeric to a Java integer
copyDirectory

Copies a directory
displayCode

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

TimeoutException represents timeout errors
Arguments$getIndices

Coerces to a integer vector and validates
GString$getBuiltinUsername

Gets the username of the user running R
mapToIntervals.numeric

Maps values to intervals
extract.array

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

Class for applicational settings
LComments

The LComments class
dataFrame

Allocates a data frame with given column classes
as.list.Options

Gets a list representation of the options
attachLocally.list

Assigns an objects elements locally
as.character.Verbose

Returns a character string version of this object
evaluate.Verbose

Evaluates a function and prints its results if above threshold
MultiVerbose

A Verbose class ignoring everything
Arguments$getFilename

Gets and validates a filename
Assert

The Assert class
NullVerbose

A Verbose class ignoring everything
exit.Verbose

Writes a message and unindents the following output
capitalize

Capitalizes/decapitalizes each character string in a vector
TextStatusBar

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

Identifies all entries with replicated values
createFileAtomically

Creates a file atomically
file.info2

Extract File Information (acknowledging symbolic file links also on Windows)
as.character.binmode

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

Function to call for finalizing the R session
egsub

Global substitute of expression using regular expressions
Options

The Options class
Java$asShort

Converts a numeric to a Java short
cmdArgsCall

Calls an R function passing command-line arguments
convertComment.SmartComments

Converts a single smart comment to R code
SmartComments

Abstract class SmartComments
isOpen.character

Checks if there is an open connection to a file
Assert$check

Static method asserting that a generic condition is true
setOption

Sets a option in R
inAnyInterval.numeric

Checks if a set of values are inside one or more intervals
Arguments$getVerbose

Coerces to Verbose object
compressFile

Compressing and decompressing files
createWindowsShortcut

Creates a Microsoft Windows Shortcut (.lnk file)
isPackageInstalled

Checks if a package is installed or not
callHooks

Call hook functions by hook name
Arguments$getRegularExpression

Gets a valid regular expression pattern
convertComment.VComments

Converts a verbose comment to R code
getAbsolutePath

Gets the absolute pathname string
cmdArgs

Simple access to parsed command-line arguments
fileAccess

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

Writes one or several empty lines
isDirectory

Checks if the file specification is a directory
popBackupFile

Drops a backup suffix from the backup pathname
Assert$inherits

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

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

Parses, evaluates and outputs a GString
on.Verbose

Turn on the output
GString$getBuiltinPid

Gets the process id of the current R session
findFiles

Finds one or several files in multiple directories
GString$getBuiltinOs

Gets the operating system of the running machine
parse.GString

Parses a GString
hasOption.Options

Checks if an option exists
Arguments$getCharacters

Coerces to a character vector and validates
commandArgs

Extract command-line arguments
pushState.Verbose

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

Assignment operator for delayed assignments
isAbsolutePath

Checks if this pathname is absolute
loadToEnv

Method to load objects to a new environment
loadAnywhere.Settings

Loads settings from file
cleanup.FileProgressBar

Removes the progress file for a file progress bar
Assert$isVector

Static method asserting thatan object is a vector
GString$getBuiltinHostname

Gets the hostname of the system running R
str.Verbose

Prints the structure of an object if above threshold
isDone.ProgressBar

Checks if progress bar is completed
nbrOfOptions.Options

Gets the number of options set
arrayIndex

Converts vector indices to array indices
onSessionExit

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

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

Class to writing verbose messages to a connection or file
VComments

The VComments class
System$findGhostscript

Searches for a Ghostview executable on the current system
swapXY.density

Swaps x and y coordinates of a density object
as.character.Options

Returns a character string version of this object
isFile

Checks if the file specification is a file
getParent

Gets the string of the parent specified by this pathname
loadObject

Method to load object from a file or a connection
Arguments$getInstanceOf

Gets an instance of the object that is of a particular class
popMessage.TextStatusBar

Adds a message above the status bar
getLoadedPathname.Settings

Gets the pathname of the settings file loaded
touchFile

Updates the timestamp of a file
print.Verbose

Prints objects if above threshold
isOn.NullVerbose

Checks if the output is on
isModified.Settings

Checks if settings has been modified compared to whats on file
callHooks.function

Call hook functions
Java$readInt

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

Reads binary data from disjoint sections of a connection or a file
getMessage.TimeoutException

Gets the message of the exception
getLabel.TextStatusBar

Gets the current value of a label
Java$readShort

Reads a Java formatted short (16 bits) from a connection
Java$readByte

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

Coerces to a logical vector and validates
less.Verbose

Creates a cloned instance with a higher threshold
popTemporaryFile

Drops a temporary suffix from the temporary pathname
onGarbageCollect

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

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

Coerces to a numeric vector and validates
getBarString.ProgressBar

Gets the progress bar string to be displayed
Arguments$getReadablePathnames

Gets a readable pathname
saveObject

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

Preprocess a vector of code lines
env

Creates a new environment, evaluates an expression therein, and returns the environment
newline.TextStatusBar

Writes a newline
Java$readUTF

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

Reads a file in table format
filePath

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

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

Parses and evaluates code from a file or a connection
doCall

Executes a function call with option to ignore unused arguments
hasUrlProtocol

Checks if one or several pathnames has a URL protocol
isVisible.NullVerbose

Checks if a certain verbose level will be shown or not
Arguments$getVector

Validates a vector
printf

C-style formatted output
timestamp.Verbose

Writes a timestamp
shell.exec2

Open a file or URL using Windows File Associations
GString$getBuiltinRversion

Gets the current R version
System$parseDebian

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

Gets current verbose threshold
installPackages

Install R packages by name or URL
off.Verbose

Turn off the output
renameFile

Renames a file (or a directory) atomically/safely
draw.density

Draws a density curve
setTimestampFormat.Verbose

Sets the default timestamp format
reset.ProgressBar

Reset progress bar
warnings.Verbose

Outputs any warnings recorded
printf.Verbose

Formats and prints object if above threshold
update.TextStatusBar

Updates the status bar (visually)
GString$getVariableValue

Gets a variable value given a name and attributes
reset.VComments

Resets a VComments compiler
subplots

Creates a grid of subplots
ruler.Verbose

Writes a ruler
hpaste

Concatenating vectors into human-readable strings
insert

Insert values to a vector at certain positions
isEof.connection

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

Sets new values of given labels
setStepLength.ProgressBar

Sets default step length
getRaw.GString

Gets the unprocessed GString
updateLabels.TextStatusBar

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

Evaluate an R expression while temporarily diverting output
useRepos

Sets package repositories
parse.SmartComments

Parses one single smart comment
getTimestampFormat.Verbose

Gets the default timestamp format
setOption.Options

Sets an option
mkdirs

Creates a directory including any necessary but nonexistent parent directories
lastModified

Gets the time when the file was last modified
mpager

A "pager" function that outputs to standard error
summary.Verbose

Generates a summary of an object if above threshold
readTableIndex

Reads a single column from file in table format
GString$getBuiltinRhome

Gets the path where R is installed
print.GString

Prints the processed GString
withSeed

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

Merges intervals
header.Verbose

Writes a header
readRdHelp

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

Resets recorded warnings
isPackageLoaded

Checks if a package is loaded or not
readWindowsShellLink

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

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

Resets a SmartComments compiler
wrap.array

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

Evaluate an R expression with repositories set temporarily
pushTemporaryFile

Appends a temporary suffix to the pathname
more.Verbose

Creates a cloned instance with a lower threshold
setTicks.ProgressBar

Sets values for which ticks should be visible
setDefaultLevel.Verbose

Sets the current default verbose level
toCamelCase

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

Gets the file names in the directory
Java$writeInt

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

Retrieves the name of the user running R
timestampOn.Verbose

Turns automatic timestamping on and off
Arguments$getDoubles

Coerces to a double vector and validates
unwrap.array

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

Retrieves the computer name of the current host
pushBackupFile

Appends a backup suffix to the pathname
setMaxValue.ProgressBar

Sets maximum value
setLabel.TextStatusBar

Sets the value of a label
Arguments$getReadablePathname

Gets a readable pathname
Assert$isMatrix

Static method asserting thatan object is a matrix
systemR

Launches another R process from within R
tempvar

Gets a unique non-existing temporary variable name
withLocale

Evaluate an R expression with locale set temporarily
promptAndSave.Settings

Prompt user to save modified settings
readWindowsShortcut

Reads a Microsoft Windows Shortcut (.lnk file)
intervalsToSeq.matrix

Generates a vector of indices from a matrix of intervals
Arguments$getWritablePathname

Gets a writable pathname
resample

Sample values from a set of elements
isUrl

Checks if one or several pathnames is URLs
isOn.Verbose

Checks if the output is on
removeDirectory

Removes a directory
patchCode

Patches installed and loaded packages and more
str.Options

Prints the structure of the options
Java$writeByte

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

Re-assigns a new value to an existing object in a loaded package
names.Options

Gets the full pathname of all (non-list) options
capture.Verbose

Captures output of a function
setThreshold.Verbose

Sets verbose threshold
toUrl

Converts a pathname into a URL
addFinalizerToLast

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

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

Sets current value
Java$writeUTF

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

Static class for Java related methods
stext

Writes text in the margin along the sides of a plot
Sys.readlink2

Read File Symbolic Links (also on Windows)
as.logical.Verbose

Gets a logical value of this object
writeDataFrame.data.frame

Writes a data.frame to tabular text file
eget

Gets a variable by name
Java$asByte

Converts a numeric to a Java byte
System$currentTimeMillis

Get the current time in milliseconds
flush.TextStatusBar

Flushes the output
writeRaw.Verbose

Writes objects if above threshold
writeRaw.MultiVerbose

Writes to each of the Verbose objects
withCapture

Evaluates an expression and captures the code and/or the output
GString$getBuiltinDatetime

Gets the current date and time
System$findGraphicsDevice

Searches for a working PNG device
withTimeout

Evaluate an R expression and interrupts it if it takes too long
Arguments$getEnvironment

Gets an existing environment
Assert$isScalar

Static method asserting thatan object is a single value
mout

Miscellaneous functions for outputting via message()
seqToHumanReadable

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

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

Gets all contigous intervals of a vector of indices
validate.SmartComments

Validates the compiled lines
update.FileProgressBar

Updates file progress bar
splitByPattern

Splits a single character string by pattern
isVisible.Verbose

Checks if a certain verbose level will be shown or not
setProgress.ProgressBar

Sets current progress
queryRCmdCheck

Gets the on R CMD check if the current R session was launched by it
whichVector.logical

Identifies TRUE elements in a logical vector
validate.VComments

Validates the compiled lines
withOptions

Evaluate an R expression with options set temporarily
writeRaw.NullVerbose

All output methods