Learn R Programming

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

R.utils (version 2.9.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.9.0

License

LGPL (>= 2.1)

Issues

Pull Requests

Stars

Forks

Last Published

June 13th, 2019

Functions in R.utils (2.9.0)

MultiVerbose

A Verbose class ignoring everything
Non-documented objects

Non-documented objects
Java

Static class for Java related methods
LComments

The LComments class
GString

Character string with advanced substitutions
FileProgressBar

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

Static class to validate and process arguments
Assert

The Assert class
Options

The Options class
TimeoutException

TimeoutException represents timeout errors
NullVerbose

A Verbose class ignoring everything
TextStatusBar

A status bar at the R prompt that can be updated
R.utils-package

Package R.utils
ProgressBar

Provides text based counting progress bar
System

Static class to query information about the system
Sys.readlink2

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

Returns a character string version of this object
callHooks.function

Call hook functions
capitalize

Capitalizes/decapitalizes each character string in a vector
attachLocally.list

Assigns an objects elements locally
as.list.Options

Gets a list representation of the options
as.logical.Verbose

Gets a logical value of this object
callHooks

Call hook functions by hook name
Java$asLong

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

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

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

Gets a numeric value of this object
Verbose

Class to writing verbose messages to a connection or file
Settings

Class for applicational settings
VComments

The VComments class
Java$asShort

Converts a numeric to a Java short
colClasses

Creates a vector of column classes used for tabular reading
cmdArgsCall

Calls an R function passing command-line arguments
commandArgs

Extract command-line arguments
compressFile

Compressing and decompressing files
Java$asByte

Converts a numeric to a Java byte
countLines

Counts the number of lines in a text file
Java$asInt

Converts an numeric to a Java integer
compressPDF

Compresses a PDF (into a new PDF)
as.list.MultiVerbose

Gets a list of Verbose objects
compile.SmartComments

Preprocess a vector of code lines
enter.Verbose

Writes a message and indents the following output
env

Creates a new environment, evaluates an expression therein, and returns the environment
as.character.ProgressBar

Gets a string description of the progress bar
cmdArgs

Simple access to parsed command-line arguments
addFinalizerToLast

Modifies .Last() to call 'finalizeSession()
as.character.GString

Gets the processed character string
System$currentTimeMillis

Get the current time in milliseconds
detachPackage

Detaches packages by name
SmartComments

Abstract class SmartComments
cleanup.FileProgressBar

Removes the progress file for a file progress bar
dataFrame

Allocates a data frame with given column classes
copyDirectory

Copies a directory
createLink

Creates a link to a file or a directory
createFileAtomically

Creates a file atomically
findFiles

Finds one or several files in multiple directories
displayCode

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

Executes a function call with option to ignore unused arguments
createWindowsShortcut

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

Searches for a Ghostview executable on the current system
fileAccess

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

Captures output of a function
file.info2

Extract File Information (acknowledging symbolic file links also on Windows)
dimNA< -

Sets the dimension of an object with the option to infer one dimension automatically
evaluate.GString

Parses and evaluates a GString
convertComment.SmartComments

Converts a single smart comment to R code
cat.Verbose

Concatenates and prints objects if above threshold
evaluate.Verbose

Evaluates a function and prints its results if above threshold
captureOutput

Evaluate an R expression and captures the output
Assert$check

Static method asserting that a generic condition is true
equals.Options

Checks if this object is equal to another Options object
eget

Gets a variable by name
copyFile

Copies a file atomically
System$findGraphicsDevice

Searches for a working PNG device
GString$getBuiltinPid

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

Gets the path where R is installed
gcat

Parses, evaluates and outputs a GString
gcDLLs

Identifies and removes DLLs of packages already unloaded
GString$getBuiltinRversion

Gets the current R version
flush.TextStatusBar

Flushes the output
findSourceTraceback

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

Checks if this object is equal to another
GString$getBuiltinUsername

Gets the username of the user running R
egsub

Global substitute of expression using regular expressions
Settings$findSettings

Searches for the settings file in one or several directories
filePath

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

Coerces to a character vector and validates
convertComment.VComments

Converts a verbose comment to R code
finalizeSession

Function to call for finalizing the R session
exit.Verbose

Writes a message and unindents the following output
downloadFile.character

Downloads a file
draw.density

Draws a density curve
GString$getBuiltinTime

Gets the current time
GString$getBuiltinDatetime

Gets the current date and time
getLeaves.Options

Gets all (non-list) options in a flat list
GString$getBuiltinDate

Gets the current date
System$getHostname

Retrieves the computer name of the current host
Arguments$getFilename

Gets and validates a filename
System$getUsername

Retrieves the name of the user running R
intToBin

Converts an integer to a binary/octal/hexadecimal number
GString$getVariableValue

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

Coerces to a logical vector and validates
getMessage.TimeoutException

Gets the message of the exception
GString$getBuiltinHostname

Gets the hostname of the system running R
getParent

Gets the string of the parent specified by this pathname
GString$getBuiltinOs

Gets the operating system of the running machine
getRaw.GString

Gets the unprocessed GString
Arguments$getVector

Validates a vector
getLabel.TextStatusBar

Gets the current value of a label
intervalsToSeq.matrix

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

Coerces to a integer vector and validates
Arguments$getReadablePathnames

Gets a readable pathname
Arguments$getReadablePathname

Gets a readable pathname
getLoadedPathname.Settings

Gets the pathname of the settings file loaded
isFile

Checks if the file specification is a file
hsize

Convert byte sizes into human-readable byte sizes
extract.array

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

Method to load object from a file or a connection
System$openBrowser

Opens an HTML document using the OS default HTML browser
printf

C-style formatted output
Assert$isVector

Static method asserting that an object is a vector
isVisible.NullVerbose

Checks if a certain verbose level will be shown or not
Assert$isMatrix

Static method asserting that an object is a matrix
loadToEnv

Method to load objects to a new environment
parse.GString

Parses a GString
inAnyInterval.numeric

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

Gets the absolute pathname string
Arguments$getVerbose

Coerces to Verbose object
gstring

Parses and evaluates a GString into a regular string
Assert$inheritsFrom

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

Checks if this pathname is absolute
increase.ProgressBar

Increases (steps) progress bar
Arguments$getWritablePathname

Gets a writable pathname
isSingle

Identifies all entries that exists exactly once
isDirectory

Checks if the file specification is a directory
listDirectory

Gets the file names in the directory
isUrl

Checks if one or several pathnames is URLs
printf.Verbose

Formats and prints object if above threshold
isDone.ProgressBar

Checks if progress bar is completed
loadAnywhere.Settings

Loads settings from file
newline.Verbose

Writes one or several empty lines
readWindowsShellLink

Reads a Microsoft Windows Shortcut (.lnk file)
ruler.Verbose

Writes a ruler
Java$readUTF

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

Gets the progress bar string to be displayed
Arguments$getInstanceOf

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

Coerces to a integer vector and validates
Arguments$getRegularExpression

Gets a valid regular expression pattern
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'
isReplicated

Identifies all entries with replicated values
nullfile

Gets the pathname or a connection to the NULL device on the current platform
saveAnywhere.Settings

Saves settings to file
sourceTo

Parses and evaluates code from a file or a connection
summary.Verbose

Generates a summary of an object if above threshold
setMaxValue.ProgressBar

Sets maximum value
subplots

Creates a grid of subplots
setOption.Options

Sets an option
sourceDirectory

Sources files recursively to either local or global environment
Arguments$getDoubles

Coerces to a double vector and validates
Arguments$getEnvironment

Gets an existing environment
popMessage.TextStatusBar

Adds a message above the status bar
Arguments$getNumerics

Coerces to a numeric vector and validates
Assert$isScalar

Static method asserting that an object is a single value
readWindowsShortcut

Reads a Microsoft Windows Shortcut (.lnk file)
popTemporaryFile

Drops a temporary suffix from the temporary pathname
getOption.Options

Gets an option
hasUrlProtocol

Checks if one or several pathnames has a URL protocol
hasOption.Options

Checks if an option exists
installPackages

Install R packages by name or URL
isZero

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

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

Re-assigns a new value to an existing object in a loaded package
reset.SmartComments

Resets a SmartComments compiler
reset.VComments

Resets a VComments compiler
on.Verbose

Turn on the output
off.Verbose

Turn off the output
mapToIntervals.numeric

Maps values to intervals
pushState.Verbose

Pushes the current indentation state of the Verbose object
mergeIntervals.numeric

Merges intervals
patchCode

Patches installed and loaded packages and more
popBackupFile

Drops a backup suffix from the backup pathname
header.Verbose

Writes a header
hpaste

Concatenating vectors into human-readable strings
touchFile

Updates the timestamp of a file
setLabel.TextStatusBar

Sets the value of a label
names.Options

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

Creates a directory including any necessary but nonexistent parent directories
parse.SmartComments

Parses one single smart comment
mpager

A \"pager\" function that outputs to standard error
more.Verbose

Creates a cloned instance with a lower threshold
Java$readInt

Reads a Java formatted int (32 bits) from a connection
Java$readByte

Reads a Java formatted byte (8 bits) from a connection
pushTemporaryFile

Appends a temporary suffix to the pathname
getRelativePath

Gets the relative pathname relative to a directory
setLabels.TextStatusBar

Sets new values of given labels
unwrap.array

Unwrap an array, matrix or a vector to an array of more dimensions
nbrOfOptions.Options

Gets the number of options set
isOn.Verbose

Checks if the output is on
newline.TextStatusBar

Writes a newline
getTimestampFormat.Verbose

Gets the default timestamp format
onSessionExit

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

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

Gets current verbose threshold
isOpen.character

Checks if there is an open connection to a file
print.GString

Prints the processed GString
System$parseDebian

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

Sample values from a set of elements
readTable

Reads a file in table format
setValue.ProgressBar

Sets current value
reset.ProgressBar

Reset progress bar
readTableIndex

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

Sets default step length
print.Verbose

Prints objects if above threshold
setThreshold.Verbose

Sets verbose threshold
withCapture

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

Saves an object to a file or a connection
isModified.Settings

Checks if settings has been modified compared to whats on file
swapXY.density

Swaps x and y coordinates of a density object
queryRCmdCheck

Gets the on R CMD check if the current R session was launched by it
shell.exec2

Open a file or URL using Windows File Associations
withLocale

Evaluate an R expression with locale set temporarily
Java$writeByte

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

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

Gets a unique non-existing temporary variable name
withTimeout

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

Removes a directory
timestamp.Verbose

Writes a timestamp
readBinFragments

Reads binary data from disjoint sections of a connection or a file
seqToHumanReadable

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

Sets a option in R
renameFile

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

Launches another R process from within R
updateLabels.TextStatusBar

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

Evaluate an R expression with a temporarily set random set
update.TextStatusBar

Updates the status bar (visually)
withSink

Evaluate an R expression while temporarily diverting output
setDefaultLevel.Verbose

Sets the current default verbose level
setTicks.ProgressBar

Sets values for which ticks should be visible
seqToIntervals

Gets all contiguous intervals of a vector of indices
writeDataFrame.data.frame

Writes a data.frame to tabular text file
wrap.array

Reshape an array or a matrix by permuting and/or joining dimensions
Java$writeInt

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

Splits a single character string by pattern
setProgress.ProgressBar

Sets current progress
writeRaw.Verbose

Writes objects if above threshold
stext

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

Attaches or loads packages
Java$writeShort

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

Checks if the output is on
tmpfile

Creates a temporary file with content
timestampOn.Verbose

Turns automatic timestamping on and off
setTimestampFormat.Verbose

Sets the default timestamp format
useRepos

Sets package repositories
validate.SmartComments

Validates the compiled lines
isPackageLoaded

Checks if a package is loaded or not
isPackageInstalled

Checks if a package is installed or not
lastModified

Gets the time when the file was last modified
validate.VComments

Validates the compiled lines
less.Verbose

Creates a cloned instance with a higher threshold
withOptions

Evaluate an R expression with options set temporarily
moveInSearchPath

Moves a environment in the search path to another position
mout

Miscellaneous functions for outputting via message()
promptAndSave.Settings

Prompt user to save modified settings
Java$writeUTF

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

Evaluate an R expression with repositories set temporarily
Java$readShort

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

Prints the structure of an object if above threshold
readRdHelp

Reads one or more Rd help files in a certain format
str.Options

Prints the structure of the options
pushBackupFile

Appends a backup suffix to the pathname
toCamelCase

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

Converts a pathname into a URL
update.FileProgressBar

Updates file progress bar
update.ProgressBar

Updates progress bar
warnings.Verbose

Outputs any warnings recorded
whichVector.logical

Identifies TRUE elements in a logical vector
writeRaw.MultiVerbose

Writes to each of the Verbose objects
writeRaw.NullVerbose

All output methods