Learn R Programming

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

R.utils (version 2.5.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.5.0

License

LGPL (>= 2.1)

Issues

Pull Requests

Stars

Forks

Last Published

November 7th, 2016

Functions in R.utils (2.5.0)

Arguments

Static class to validate and process arguments
addFinalizerToLast

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

Gets a string description of the progress bar
as.character.Options

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

Gets the processed character string
as.double.Verbose

Gets a numeric value of this object
as.list.MultiVerbose

Gets a list of Verbose objects
as.character.binmode

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

Returns a character string version of this object
arrayIndex

Converts vector indices to array indices
Java$asLong

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

Gets a list representation of the options
Java$asShort

Converts a numeric to a Java short
Java$asByte

Converts a numeric to a Java byte
Java$asInt

Converts an numeric to a Java integer
callHooks

Call hook functions by hook name
as.logical.Verbose

Gets a logical value of this object
attachLocally.list

Assigns an objects elements locally
callHooks.function

Call hook functions
Assert

The Assert class
colClasses

Creates a vector of column classes used for tabular reading
capitalize

Capitalizes/decapitalizes each character string in a vector
cmdArgs

Simple access to parsed command-line arguments
cmdArgsCall

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

Concatenates and prints objects if above threshold
Assert$check

Static method asserting that a generic condition is true
cleanup.FileProgressBar

Removes the progress file for a file progress bar
capture.Verbose

Captures output of a function
commandArgs

Extract command-line arguments
captureOutput

Evaluate an R expression and captures the output
compressPDF

Compresses a PDF (into a new PDF)
createLink

Creates a link to a file or a directory
createFileAtomically

Creates a file atomically
copyFile

Copies a file atomically
countLines

Counts the number of lines in a text file
compile.SmartComments

Preprocess a vector of code lines
compressFile

Compressing and decompressing files
convertComment.VComments

Converts a verbose comment to R code
copyDirectory

Copies a directory
convertComment.SmartComments

Converts a single smart comment to R code
draw.density

Draws a density curve
System$currentTimeMillis

Get the current time in milliseconds
createWindowsShortcut

Creates a Microsoft Windows Shortcut (.lnk file)
displayCode

Displays the contents of a text file with line numbers and more
dimNA< -

Sets the dimension of an object with the option to infer one dimension autmatically
downloadFile.character

Downloads a file
doCall

Executes a function call with option to ignore unused arguments
dataFrame

Allocates a data frame with given column classes
detachPackage

Detaches packages by name
eget

Gets a variable by name
egsub

Global substitute of expression using regular expressions
env

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

Writes a message and indents the following output
equals.Options

Checks if this object is equal to another Options object
evaluate.Verbose

Evaluates a function and prints its results if above threshold
exit.Verbose

Writes a message and unindents the following output
extract.array

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

Extract File Information (acknowledging symbolic file links also on Windows)
equals.Verbose

Checks if this object is equal to another
evaluate.GString

Parses and evaluates a GString
fileAccess

Checks the permission of a file or a directory
GString$getBuiltinDatetime

Gets the current date and time
filePath

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

Coerces to a integer vector and validates
GString$getBuiltinDate

Gets the current date
Arguments$getInstanceOf

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

Coerces to a numeric vector and validates
getOption.Options

Gets an option
Arguments$getVector

Validates a vector
Arguments$getVerbose

Coerces to Verbose object
flush.TextStatusBar

Flushes the output
findSourceTraceback

Finds all 'srcfile' objects generated by source() in all call frames
getBarString.ProgressBar

Gets the progress bar string to be displayed
getAbsolutePath

Gets the absolute pathname string
Arguments$getCharacters

Coerces to a character vector and validates
GString$getBuiltinUsername

Gets the username of the user running R
getLeaves.Options

Gets all (non-list) options in a flat list
getLoadedPathname.Settings

Gets the pathname of the settings file loaded
Arguments$getRegularExpression

Gets a valid regular expression pattern
getRelativePath

Gets the relative pathname relative to a directory
GString$getBuiltinPid

Gets the process id of the current R session
Arguments$getIntegers

Coerces to a integer vector and validates
GString$getBuiltinRhome

Gets the path where R is installed
getThreshold.Verbose

Gets current verbose threshold
getLabel.TextStatusBar

Gets the current value of a label
getTimestampFormat.Verbose

Gets the default timestamp format
gstring

Parses and evaluates a GString into a regular string
hasOption.Options

Checks if an option exists
Assert$inherits

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

Insert values to a vector at certain positions
findFiles

Finds one or several files in multiple directories
System$findGhostscript

Searches for a Ghostview executable on the current system
GString$getBuiltinHostname

Gets the hostname of the system running R
GString$getBuiltinOs

Gets the operating system of the running machine
Arguments$getFilename

Gets and validates a filename
System$getHostname

Retrieves the computer name of the current host
getParent

Gets the string of the parent specified by this pathname
getRaw.GString

Gets the unprocessed GString
System$getUsername

Retrieves the name of the user running R
GString$getVariableValue

Gets a variable value given a name and attributes
System$findGraphicsDevice

Searches for a working PNG device
gcDLLs

Identifies and removes DLLs of packages already unloaded
gcat

Parses, evaluates and outputs a GString
Settings$findSettings

Searches for the settings file in one or several directories
GString$getBuiltinRversion

Gets the current R version
GString$getBuiltinTime

Gets the current time
getMessage.TimeoutException

Gets the message of the exception
Arguments$getLogicals

Coerces to a logical vector and validates
intToBin

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

Checks if this pathname is absolute
Arguments$getWritablePathname

Gets a writable pathname
more.Verbose

Creates a cloned instance with a lower threshold
isZero

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

Miscellaneous functions for outputting via message()
Java

Static class for Java related methods
parse.SmartComments

Parses one single smart comment
parse.GString

Parses a GString
popTemporaryFile

Drops a temporary suffix from the temporary pathname
print.GString

Prints the processed GString
reassignInPackage

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

Removes a directory
isFile

Checks if the file specification is a file
isOpen.character

Checks if there is an open connection to a file
isEof.connection

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

Checks if a package is installed or not
isVisible.NullVerbose

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

Merges intervals
isVisible.Verbose

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

Creates a directory including any necessary but nonexistent parent directories
setOption.Options

Sets an option
TextStatusBar

A status bar at the R prompt that can be updated
setProgress.ProgressBar

Sets current progress
warnings.Verbose

Outputs any warnings recorded
tempvar

Gets a unique non-existing temporary variable name
whichVector.logical

Identifies TRUE elements in a logical vector
isOn.NullVerbose

Checks if the output is on
isOn.Verbose

Checks if the output is on
isUrl

Checks if one or several pathnames is URLs
Assert$isVector

Static method asserting thatan object is a vector
popBackupFile

Drops a backup suffix from the backup pathname
nullfile

Gets the pathname of the NULL device on the current platform
popMessage.TextStatusBar

Adds a message above the status bar
NullVerbose

A Verbose class ignoring everything
hasUrlProtocol

Checks if one or several pathnames has a URL protocol
pushState.Verbose

Pushes the current indentation state of the Verbose object
header.Verbose

Writes a header
isDirectory

Checks if the file specification is a directory
isDone.ProgressBar

Checks if progress bar is completed
isPackageLoaded

Checks if a package is loaded or not
isReplicated

Identifies all entries with replicated values
listDirectory

Gets the file names in the directory
less.Verbose

Creates a cloned instance with a higher threshold
loadToEnv

Method to load objects to a new environment
mapToIntervals.numeric

Maps values to intervals
newline.Verbose

Writes one or several empty lines
Non-documented objects

Non-documented objects
Java$readInt

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

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

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

Sample values from a set of elements
seqToHumanReadable

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

Saves an object to a file or a connection
sourceTo

Parses and evaluates code from a file or a connection
sourceDirectory

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

Turns automatic timestamping on and off
tmpfile

Creates a temporary file with content
use

Attaches or loads packages
useRepos

Sets package repositories
withSeed

Evaluate an R expression with a temporarily set random set
withSink

Evaluate an R expression while temporarily diverting output
Java$writeShort

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

Writes objects if above threshold
Java$writeUTF

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

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

A Verbose class ignoring everything
System$openBrowser

Opens an HTML document using the OS default HTML browser
Options

The Options class
ProgressBar

Provides text based counting progress bar
printf.Verbose

Formats and prints object if above threshold
readTableIndex

Reads a single column from file in table format
reset.VComments

Resets a VComments compiler
Java$readUTF

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

Resets recorded warnings
pushTemporaryFile

Appends a temporary suffix to the pathname
readBinFragments

Reads binary data from disjoint sections of a connection or a file
Java$readByte

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

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

Sets the current default verbose level
Settings

Class for applicational settings
setValue.ProgressBar

Sets current value
hpaste

Concatenating vectors into human-readable strings
str.Options

Prints the structure of the options
str.Verbose

Prints the structure of an object if above threshold
hsize

Convert byte sizes into human-readable byte sizes
intervalsToSeq.matrix

Generates a vector of indices from a matrix of intervals
installPackages

Install R packages by name or URL
Assert$isMatrix

Static method asserting thatan object is a matrix
isModified.Settings

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

Moves a environment in the search path to another position
mpager

A \"pager\" function that outputs to standard error
finalizeSession

Function to call for finalizing the R session
nbrOfOptions.Options

Gets the number of options set
FileProgressBar

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

Coerces to a double vector and validates
Arguments$getEnvironment

Gets an existing environment
Arguments$getReadablePathname

Gets a readable pathname
Arguments$getReadablePathnames

Gets a readable pathname
inAnyInterval.numeric

Checks if a set of values are inside one or more intervals
increase.ProgressBar

Increases (steps) progress bar
Assert$isScalar

Static method asserting thatan object is a single value
isSingle

Identifies all entries that exists exactly ones
saveAnywhere.Settings

Saves settings to file
ruler.Verbose

Writes a ruler
setTicks.ProgressBar

Sets values for which ticks should be visible
setTimestampFormat.Verbose

Sets the default timestamp format
splitByPattern

Splits a single character string by pattern
stext

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

Static class to query information about the system
systemR

Launches another R process from within R
updateLabels.TextStatusBar

Sets the new values of given labels and updates the status bar
update.TextStatusBar

Updates the status bar (visually)
LComments

The LComments class
lastModified

Gets the time when the file was last modified
loadAnywhere.Settings

Loads settings from file
loadObject

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

Turn off the output
on.Verbose

Turn on the output
System$parseDebian

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

Patches installed and loaded packages and more
newline.TextStatusBar

Writes a newline
print.Verbose

Prints objects if above threshold
onGarbageCollect

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

Prompt user to save modified settings
onSessionExit

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

Appends a backup suffix to the pathname
Java$readShort

Reads a Java formatted short (16 bits) from a connection
readTable

Reads a file in table format
reset.ProgressBar

Reset progress bar
reset.SmartComments

Resets a SmartComments compiler
printf

C-style formatted output
R.utils-package

Package R.utils
queryRCmdCheck

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

Reads a Microsoft Windows Shortcut (.lnk file)
readWindowsShellLink

Reads a Microsoft Windows Shortcut (.lnk file)
setLabels.TextStatusBar

Sets new values of given labels
setLabel.TextStatusBar

Sets the value of a label
setStepLength.ProgressBar

Sets default step length
setThreshold.Verbose

Sets verbose threshold
swapXY.density

Swaps x and y coordinates of a density object
Sys.readlink2

Read File Symbolic Links (also on Windows)
timestamp.Verbose

Writes a timestamp
TimeoutException

TimeoutException represents timeout errors
unwrap.array

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

Converts a pathname into a URL
withRepos

Evaluate an R expression with repositories set temporarily
withOptions

Evaluate an R expression with options set temporarily
withTimeout

Evaluate an R expression and interrupts it if it takes too long
wrap.array

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

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

Updates the timestamp of a file
validate.VComments

Validates the compiled lines
validate.SmartComments

Validates the compiled lines
Verbose

Class to writing verbose messages to a connection or file
VComments

The VComments class
writeDataFrame.data.frame

Writes a data.frame to tabular text file
Java$writeInt

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

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

Evaluate an R expression with locale set temporarily
writeRaw.MultiVerbose

Writes to each of the Verbose objects
writeRaw.NullVerbose

All output methods
setMaxValue.ProgressBar

Sets maximum value
setOption

Sets a option in R
shell.exec2

Open a file or URL using Windows File Associations
SmartComments

Abstract class SmartComments
subplots

Creates a grid of subplots
summary.Verbose

Generates a summary of an object if above threshold
update.FileProgressBar

Updates file progress bar
update.ProgressBar

Updates progress bar
writeBinFragments

Writes binary data to disjoint sections of a connection or a file
Java$writeByte

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