Learn R Programming

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

R.utils (version 2.3.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.3.0

License

LGPL (>= 2.1)

Issues

Pull Requests

Stars

Forks

Last Published

April 14th, 2016

Functions in R.utils (2.3.0)

getBarString.ProgressBar

Gets the progress bar string to be displayed
createFileAtomically

Creates a file atomically
as.list.MultiVerbose

Gets a list of Verbose objects
filePath

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

Gets a valid regular expression pattern
setDefaultLevel.Verbose

Sets the current default verbose level
GString$getBuiltinPid

Gets the process id of the current R session
readWindowsShellLink

Reads a Microsoft Windows Shortcut (.lnk file)
GString$getBuiltinOs

Gets the operating system of the running machine
LComments

The LComments class
str.Options

Prints the structure of the options
Arguments$getInstanceOf

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

Checks if one or several pathnames has a URL protocol
as.character.ProgressBar

Gets a string description of the progress bar
downloadFile.character

Downloads a file
timestamp.Verbose

Writes a timestamp
print.Verbose

Prints objects if above threshold
isSingle

Identifies all entries that exists exactly ones
System$getUsername

Retrieves the name of the user running R
getLabel.TextStatusBar

Gets the current value of a label
NullVerbose

A Verbose class ignoring everything
writeRaw.NullVerbose

All output methods
Java$asShort

Converts a numeric to a Java short
Assert

The Assert class
callHooks

Call hook functions by hook name
exit.Verbose

Writes a message and unindents the following output
hasOption.Options

Checks if an option exists
Non-documented objects

Non-documented objects
Java$asLong

Converts a numeric to a Java long
attachLocally.list

Assigns an objects elements locally
TextStatusBar

A status bar at the R prompt that can be updated
as.character.GString

Gets the processed character string
ProgressBar

Provides text based counting progress bar
compile.SmartComments

Preprocess a vector of code lines
Java

Static class for Java related methods
enter.Verbose

Writes a message and indents the following output
Assert$isScalar

Static method asserting thatan object is a single value
as.logical.Verbose

Gets a logical value of this object
MultiVerbose

A Verbose class ignoring everything
System$currentTimeMillis

Get the current time in milliseconds
as.list.Options

Gets a list representation of the options
cat.Verbose

Concatenates and prints objects if above threshold
addFinalizerToLast

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

Calls an R function passing command-line arguments
getRaw.GString

Gets the unprocessed GString
TimeoutException

TimeoutException represents timeout errors
displayCode

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

Copies a directory
GString

Parses and evaluates a GString into a regular string
as.character.binmode

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

Drops a backup suffix from the backup pathname
captureOutput

Evaluate an R expression and captures the output
Arguments$getDoubles

Coerces to a double vector and validates
capture.Verbose

Captures output of a function
System

Static class to query information about the system
findFiles

Finds one or several files in multiple directories
mkdirs

Creates a directory including any necessary but nonexistent parent directories
commandArgs

Extract command-line arguments
convertComment.SmartComments

Converts a single smart comment to R code
queryRCmdCheck

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

Converts a numeric to a Java byte
getLeaves.Options

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

Coerces to a numeric vector and validates
touchFile

Updates the timestamp of a file
PERCENT< -PERCENT

Assignment operator for delayed assignments ('lazy future')
Arguments$getFilename

Gets and validates a filename
FileProgressBar

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

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

Allocates a data frame with given column classes
getMessage.TimeoutException

Gets the message of the exception
draw.density

Draws a density curve
cmdArgs

Simple access to parsed command-line arguments
evaluate.Verbose

Evaluates a function and prints its results if above threshold
countLines

Counts the number of lines in a text file
extract.array

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

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

Capitalizes/decapitalizes each character string in a vector
Arguments$getWritablePathname

Gets a writable pathname
compressPDF

Compresses a PDF (into a new PDF)
callHooks.function

Call hook functions
VComments

The VComments class
colClasses

Creates a vector of column classes used for tabular reading
Java$asInt

Converts an numeric to a Java integer
as.character.Options

Returns a character string version of this object
GString$getBuiltinDatetime

Gets the current date and time
GString$getBuiltinDate

Gets the current date
intervalsToSeq.matrix

Generates a vector of indices from a matrix of intervals
dimNA< -

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

Identifies all entries with replicated values
Settings

Class for applicational settings
Verbose

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

Writes objects if above threshold
compressFile

Compressing and decompressing files
Settings$findSettings

Searches for the settings file in one or several directories
Arguments$getIntegers

Coerces to a integer vector and validates
hpaste

Concatenating vectors into human-readable strings
moveInSearchPath

Moves a environment in the search path to another position
getThreshold.Verbose

Gets current verbose threshold
evaluate.GString

Parses and evaluates a GString
off.Verbose

Turn off the output
isModified.Settings

Checks if settings has been modified compared to whats on file
GString$getBuiltinRhome

Gets the path where R is installed
readWindowsShortcut

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

Coerces to a character vector and validates
Arguments$getReadablePathname

Gets a readable pathname
setStepLength.ProgressBar

Sets default step length
Arguments$getReadablePathnames

Gets a readable pathname
mapToIntervals.numeric

Maps values to intervals
arrayIndex

Converts vector indices to array indices
gcat

Parses, evaluates and outputs a GString
getRelativePath

Gets the relative pathname relative to a directory
shell.exec2

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

Gets the username of the user running R
Sys.readlink2

Read File Symbolic Links (also on Windows)
subplots

Creates a grid of subplots
reset.VComments

Resets a VComments compiler
Arguments$getVector

Validates a vector
cleanup.FileProgressBar

Removes the progress file for a file progress bar
readTable

Reads a file in table format
getLoadedPathname.Settings

Gets the pathname of the settings file loaded
nbrOfOptions.Options

Gets the number of options set
finalizeSession

Function to call for finalizing the R session
System$findGhostscript

Searches for a Ghostview executable on the current system
Assert$check

Static method asserting that a generic condition is true
Java$readShort

Reads a Java formatted short (16 bits) from a connection
updateLabels.TextStatusBar

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

Appends a temporary suffix to the pathname
doCall

Executes a function call with option to ignore unused arguments
saveAnywhere.Settings

Saves settings to file
copyFile

Copies a file atomically
createWindowsShortcut

Creates a Microsoft Windows Shortcut (.lnk file)
createLink

Creates a link to a file or a directory
Arguments$getIndices

Coerces to a integer vector and validates
getOption.Options

Gets an option
header.Verbose

Writes a header
installPackages

Install R packages by name or URL
toUrl

Converts a pathname into a URL
hsize

Convert byte sizes into human-readable byte sizes
withLocale

Evaluate an R expression with locale set temporarily
getAbsolutePath

Gets the absolute pathname string
isPackageInstalled

Checks if a package is installed or not
Java$readUTF

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

Evaluate an R expression while temporarily diverting output
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'
parse.SmartComments

Parses one single smart comment
isUrl

Checks if one or several pathnames is URLs
readRdHelp

Reads one or more Rd help files in a certain format
getTimestampFormat.Verbose

Gets the default timestamp format
detachPackage

Detaches packages by name
isZero

Checks if a value is (close to) zero or not
GString$getBuiltinRversion

Gets the current R version
increase.ProgressBar

Increases (steps) progress bar
newline.Verbose

Writes one or several empty lines
Java$readByte

Reads a Java formatted byte (8 bits) from a connection
R.utils-package

Package R.utils
patchCode

Patches installed and loaded packages and more
lastModified

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

Sets new values of given labels
SmartComments

Abstract class SmartComments
Java$writeShort

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

Gets an existing environment
getParent

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

Gets the hostname of the system running R
GString$getBuiltinTime

Gets the current time
fileAccess

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

Formats and prints object if above threshold
on.Verbose

Turn on the output
Java$writeUTF

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

C-style formatted output
isOn.NullVerbose

Checks if the output is on
isVisible.NullVerbose

Checks if a certain verbose level will be shown or not
inAnyInterval.numeric

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

Returns a character string version of this object
setValue.ProgressBar

Sets current value
onGarbageCollect

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

Converts a verbose comment to R code
readBinFragments

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

The Options class
renameFile

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

Evaluate an R expression with repositories set temporarily
System$getHostname

Retrieves the computer name of the current host
eget

Gets a variable by name
update.ProgressBar

Updates progress bar
reassignInPackage

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

Method to load object from a file or a connection
equals.Options

Checks if this object is equal to another Options object
file.info2

Extract File Information (acknowledging symbolic file links also on Windows)
Java$writeByte

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

Appends a backup suffix to the pathname
newline.TextStatusBar

Writes a newline
isDone.ProgressBar

Checks if progress bar is completed
flush.TextStatusBar

Flushes the output
Assert$isVector

Static method asserting thatan object is a vector
mergeIntervals.numeric

Merges intervals
less.Verbose

Creates a cloned instance with a higher threshold
setTicks.ProgressBar

Sets values for which ticks should be visible
sourceDirectory

Sources files recursively to either local or global environment
isOn.Verbose

Checks if the output is on
popMessage.TextStatusBar

Adds a message above the status bar
isDirectory

Checks if the file specification is a directory
setOption.Options

Sets an option
print.GString

Prints the processed GString
names.Options

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

Static class to validate and process arguments
reset.SmartComments

Resets a SmartComments compiler
withOptions

Evaluate an R expression with options set temporarily
onSessionExit

Registers a function to be called when the R session finishes
as.double.Verbose

Gets a numeric value of this object
loadAnywhere.Settings

Loads settings from file
str.Verbose

Prints the structure of an object if above threshold
loadToEnv

Method to load objects to a new environment
summary.Verbose

Generates a summary of an object if above threshold
System$parseDebian

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

Sets current progress
env

Creates a new environment, evaluates an expression therein, and returns the environment
ruler.Verbose

Writes a ruler
readTableIndex

Reads a single column from file in table format
tempvar

Gets a unique non-existing temporary variable name
GString$getVariableValue

Gets a variable value given a name and attributes
equals.Verbose

Checks if this object is equal to another
egsub

Global substitute of expression using regular expressions
isFile

Checks if the file specification is a file
tmpfile

Creates a temporary file with content
setOption

Sets a option in R
Arguments$getLogicals

Coerces to a logical vector and validates
isOpen.character

Checks if there is an open connection to a file
listDirectory

Gets the file names in the directory
System$findGraphicsDevice

Searches for a working PNG device
isAbsolutePath

Checks if this pathname is absolute
mout

Miscellaneous functions for outputting via message()
swapXY.density

Swaps x and y coordinates of a density object
resetWarnings

Resets recorded warnings
use

Attaches or loads packages
validate.VComments

Validates the compiled lines
mpager

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

Creates a cloned instance with a lower threshold
Assert$isMatrix

Static method asserting thatan object is a matrix
validate.SmartComments

Validates the compiled lines
update.FileProgressBar

Updates file progress bar
popTemporaryFile

Drops a temporary suffix from the temporary pathname
wrap.array

Reshape an array or a matrix by permuting and/or joining dimensions
setLabel.TextStatusBar

Sets the value of a label
reset.ProgressBar

Reset progress bar
timestampOn.Verbose

Turns automatic timestamping on and off
System$openBrowser

Opens an HTML document using the OS default HTML browser
isPackageLoaded

Checks if a package is loaded or not
Java$readInt

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

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

Parses and evaluates code from a file or a connection
promptAndSave.Settings

Prompt user to save modified settings
removeDirectory

Removes a directory
withSeed

Evaluate an R expression with a temporarily set random set
Arguments$getVerbose

Coerces to Verbose object
Assert$inherits

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

Gets all contigous intervals of a vector of indices
saveObject

Saves an object to a file or a connection
writeDataFrame.data.frame

Writes a data.frame to tabular text file
setTimestampFormat.Verbose

Sets the default timestamp format
resample

Sample values from a set of elements
splitByPattern

Splits a single character string by pattern
setMaxValue.ProgressBar

Sets maximum value
seqToHumanReadable

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

Writes text in the margin along the sides of a plot
Java$writeInt

Writes a integer (32 bits) to a connection in Java format
whichVector.logical

Identifies TRUE elements in a logical vector
toCamelCase

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

Launches another R process from within R
warnings.Verbose

Outputs any warnings recorded
update.TextStatusBar

Updates the status bar (visually)
parse.GString

Parses a GString
setThreshold.Verbose

Sets verbose threshold
useRepos

Sets package repositories
isVisible.Verbose

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

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

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

Writes binary data to disjoint sections of a connection or a file
writeRaw.MultiVerbose

Writes to each of the Verbose objects
pushState.Verbose

Pushes the current indentation state of the Verbose object