Learn R Programming

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

R.utils (version 1.33.0)

Various programming utilities

Description

This package provides utility methods useful when programming and developing R packages.

Copy Link

Version

Install

install.packages('R.utils')

Monthly Downloads

171,037

Version

1.33.0

License

LGPL (>= 2.1)

Maintainer

Henrik Bengtsson

Last Published

August 26th, 2014

Functions in R.utils (1.33.0)

Java

Static class for Java related methods
Non-documented objects

Non-documented objects
Java$asByte

Converts a numeric to a Java byte
as.character.binmode

Converts a binary/octal/hexadecimal number into a string
cat.Verbose

Concatenates and prints objects if above threshold
evaluate.Verbose

Evaluates a function and prints its results if above threshold
TimeoutException

TimeoutException represents timeout errors
ProgressBar

Provides text based counting progress bar
as.list.Options

Gets a list representation of the options
GString

Character string with advanced substitutions
as.character.Options

Returns a character string version of this object
as.list.MultiVerbose

Gets a list of Verbose objects
Java$asInt

Converts an numeric to a Java integer
SmartComments

Abstract class SmartComments
GString$getBuiltinOs

Gets the operating system of the running machine
MultiVerbose

A Verbose class ignoring everything
Settings

Class for applicational settings
GString$getBuiltinRhome

Gets the path where R is installed
evaluate.GString

Parses and evaluates a GString
bunzip2

Bunzip a file
header.Verbose

Writes a header
cmdArgs

Simple access to parsed command-line arguments
isSingle

Identifies all entries that exists exactly ones
callHooks.function

Call hook functions
as.character.GString

Gets the processed character string
cmdArgsCall

Calls an R function passing command-line arguments
captureOutput

Evaluate an R expression and captures the output
Options

The Options class
dataFrame

Allocates a data frame with given column classes
as.double.Verbose

Gets a numeric value of this object
System

Static class to query information about the system
Arguments$getLogicals

Coerces to a logical vector and validates
getLoadedPathname.Settings

Gets the pathname of the settings file loaded
equals.Verbose

Checks if this object is equal to another
Assert$check

Static method asserting that a generic condition is true
countLines

Counts the number of lines in a text file
R.utils-package

Package R.utils
commandArgs

Extract command-line arguments
VComments

The VComments class
getRelativePath

Gets the relative pathname relative to a directory
getParent

Gets the string of the parent specified by this pathname
Java$asLong

Converts a numeric to a Java long
Arguments$getNumerics

Coerces to a numeric vector and validates
Arguments

Static class to validate and process arguments
createFileAtomically

Creates a file atomically
enter.Verbose

Writes a message and indents the following output
Arguments$getIndices

Coerces to a integer vector and validates
convertComment.VComments

Converts a verbose comment to R code
System$currentTimeMillis

Get the current time in milliseconds
copyFile

Copies a file atomically
colClasses

Creates a vector of column classes used for tabular reading
capture.Verbose

Captures output of a function
createWindowsShortcut

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

Searches for a Ghostview executable on the current system
getAbsolutePath

Gets the absolute pathname string
doCall

Executes a function call with option to ignore unused arguments
detachPackage

Detaches packages by name
isDone.ProgressBar

Checks if progress bar is completed
displayCode

Displays the contents of a text file with line numbers and more
draw.density

Draws a density curve
NullVerbose

A Verbose class ignoring everything
equals.Options

Checks if this object is equal to another Options object
callHooks

Call hook functions by hook name
PERCENT< -PERCENT

Assignment operator for delayed assignments
as.logical.Verbose

Gets a logical value of this object
LComments

The LComments class
GString$getBuiltinRversion

Gets the current R version
eget

Gets a variable by name
findSourceTraceback

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

Gets the time when the file was last modified
isVisible.NullVerbose

Checks if a certain verbose level will be shown or not
getMessage.TimeoutException

Gets the message of the exception
compile.SmartComments

Preprocess a vector of code lines
onGarbageCollect

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

Creates a link to a file or a directory
Java$asShort

Converts a numeric to a Java short
TextStatusBar

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

Class to writing verbose messages to a connection or file
findFiles

Finds one or several files in multiple directories
isEof.connection

Checks if the current file position for a connection is at the 'End of File'
Arguments$getVector

Validates a vector
getBarString.ProgressBar

Gets the progress bar string to be displayed
System$getUsername

Retrieves the name of the user running R
convertComment.SmartComments

Converts a single smart comment to R code
hasUrlProtocol

Checks if one or several pathnames has a URL protocol
System$getHostname

Retrieves the computer name of the current host
as.character.Verbose

Returns a character string version of this object
cleanup.FileProgressBar

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

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

Checks if a package is loaded or not
downloadFile.character

Downloads a file
Arguments$getDoubles

Coerces to a double vector and validates
Assert$inherits

Static method asserting that an object inherits from of a certain class
file.info2

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

Gets a string description of the progress bar
arrayIndex

Converts vector indices to array indices
Assert

The Assert class
parse.GString

Parses a GString
gcat

Parses, evaluates and outputs a GString
setOption.Options

Sets an option
onSessionExit

Registers a function to be called when the R session finishes
Java$readShort

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

Prints objects if above threshold
Arguments$getCharacters

Coerces to a character vector and validates
System$parseDebian

Parses a string, file or connection for Debian formatted parameters
flush.TextStatusBar

Flushes the output
Arguments$getVerbose

Coerces to Verbose object
isPackageInstalled

Checks if a package is installed or not
isAbsolutePath

Checks if this pathname is absolute
listDirectory

Gets the file names in the directory
printf.Verbose

Formats and prints object if above threshold
exit.Verbose

Writes a message and unindents the following output
dimNA< -

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

Turn on the output
popTemporaryFile

Drops a temporary suffix from the temporary pathname
hpaste

Concatenating vectors into human-readable strings
swapXY.density

Swaps x and y coordinates of a density object
readTable

Reads a file in table format
isFile

Checks if the file specification is a file
Java$readInt

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

Splits a single character string by pattern
GString$getBuiltinPid

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

Gets an existing environment
GString$getBuiltinTime

Gets the current time
str.Verbose

Prints the structure of an object if above threshold
GString$getVariableValue

Gets a variable value given a name and attributes
GString$getBuiltinDate

Gets the current date
getLabel.TextStatusBar

Gets the current value of a label
installPackages

Install R packages by name or URL
getLeaves.Options

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

Miscellaneous functions for outputting via message()
seqToHumanReadable

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

Gets a unique non-existing temporary variable name
loadToEnv

Method to load objects to a new environment
pushState.Verbose

Pushes the current indentation state of the Verbose object
removeDirectory

Removes a directory
getOption.Options

Gets an option
setMaxValue.ProgressBar

Sets maximum value
setStepLength.ProgressBar

Sets default step length
mapToIntervals.numeric

Maps values to intervals
moveInSearchPath

Moves a environment in the search path to another position
Assert$isMatrix

Static method asserting thatan object is a matrix
isOn.Verbose

Checks if the output is on
useRepos

Sets package repositories
popBackupFile

Drops a backup suffix from the backup pathname
isReplicated

Identifies all entries with replicated values
setTicks.ProgressBar

Sets values for which ticks should be visible
reset.SmartComments

Resets a SmartComments compiler
toCamelCase

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

Appends a backup suffix to the pathname
writeBinFragments

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

Gets all contigous intervals of a vector of indices
readWindowsShortcut

Reads a Microsoft Windows Shortcut (.lnk file)
validate.VComments

Validates the compiled lines
mkdirs

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

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

Evaluate an R expression with options set temporarily
setDefaultLevel.Verbose

Sets the current default verbose level
fileAccess

Checks the permission of a file or a directory
subplots

Creates a grid of subplots
readBinFragments

Reads binary data from disjoint sections of a connection or a file
print.GString

Prints the processed GString
setProgress.ProgressBar

Sets current progress
reset.VComments

Resets a VComments compiler
withLocale

Evaluate an R expression with locale set temporarily
resample

Sample values from a set of elements
increase.ProgressBar

Increases (steps) progress bar
sourceTo

Parses and evaluates code from a file or a connection
isZero

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

Gzip/Gunzip a file
Java$writeShort

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

Gets a readable pathname
intToBin

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

Evaluate an R expression with repositories set temporarily
isUrl

Checks if one or several pathnames is URLs
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
isOn.NullVerbose

Checks if the output is on
reassignInPackage

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

C-style formatted output
updateLabels.TextStatusBar

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

Sets new values of given labels
Sys.readlink2

Read File Symbolic Links (also on Windows)
readRdHelp

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

Prints the structure of the options
less.Verbose

Creates a cloned instance with a higher threshold
finalizeSession

Function to call for finalizing the R session
writeRaw.Verbose

Writes objects if above threshold
loadObject

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

Writes one or several empty lines
timestamp.Verbose

Writes a timestamp
timestampOn.Verbose

Turns automatic timestamping on and off
ruler.Verbose

Writes a ruler
summary.Verbose

Generates a summary of an object if above threshold
warnings.Verbose

Outputs any warnings recorded
saveObject

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

Prompt user to save modified settings
reset.ProgressBar

Reset progress bar
newline.TextStatusBar

Writes a newline
withTimeout

Evaluate an R expression and interrupts it if it takes too long
setTimestampFormat.Verbose

Sets the default timestamp format
wrap.array

Reshape an array or a matrix by permuting and/or joining dimensions
Assert$isVector

Static method asserting thatan object is a vector
writeRaw.MultiVerbose

Writes to each of the Verbose objects
writeRaw.NullVerbose

All output methods
nbrOfOptions.Options

Gets the number of options set
whichVector.logical

Identifies TRUE elements in a logical vector
mergeIntervals.numeric

Merges intervals
update.ProgressBar

Updates progress bar
setOption

Sets a option in R
Java$writeByte

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

Adds a message above the status bar
setValue.ProgressBar

Sets current value
update.FileProgressBar

Updates file progress bar
writeDataFrame.data.frame

Writes a data.frame to tabular text file
sourceDirectory

Sources files recursively to either local or global environment
touchFile

Updates the timestamp of a file
toUrl

Converts a pathname into a URL
extract.array

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

Checks if an option exists
System$findGraphicsDevice

Searches for a working PNG device
getTimestampFormat.Verbose

Gets the default timestamp format
System$openBrowser

Opens an HTML document using the OS default HTML browser
GString$getBuiltinHostname

Gets the hostname of the system running R
Arguments$getWritablePathname

Gets a writable pathname
isDirectory

Checks if the file specification is a directory
isModified.Settings

Checks if settings has been modified compared to whats on file
setLabel.TextStatusBar

Sets the value of a label
more.Verbose

Creates a cloned instance with a lower threshold
off.Verbose

Turn off the output
saveAnywhere.Settings

Saves settings to file
readWindowsShellLink

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

Reads a Java (UTF-8) formatted string from a connection
unwrap.array

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

Modifies .Last() to call 'finalizeSession()
attachLocally.list

Assigns an objects elements locally
loadAnywhere.Settings

Loads settings from file
isOpen.character

Checks if there is an open connection to a file
pushTemporaryFile

Appends a temporary suffix to the pathname
resetWarnings

Resets recorded warnings
update.TextStatusBar

Updates the status bar (visually)
use

Attaches or loads packages
FileProgressBar

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

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

Gets a readable pathname
insert

Insert values to a vector at certain positions
patchCode

Patches installed and loaded packages and more
parse.SmartComments

Parses one single smart comment
renameFile

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

Gets the on R CMD check if the current R session was launched by it
setThreshold.Verbose

Sets verbose threshold
withCapture

Evaluates an expression and captures the code and/or the output
intervalsToSeq.matrix

Generates a vector of indices from a matrix of intervals
copyDirectory

Copies a directory
capitalize

Capitalizes/decapitalizes each character string in a vector
env

Creates a new environment, evaluates an expression therein, and returns the environment
Settings$findSettings

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

Gets the current date and time
Arguments$getInstanceOf

Gets an instance of the object that is of a particular class
getRaw.GString

Gets the unprocessed GString
Arguments$getRegularExpression

Gets a valid regular expression pattern
getThreshold.Verbose

Gets current verbose threshold
Assert$isScalar

Static method asserting thatan object is a single value
systemR

Launches another R process from within R
Arguments$getFilename

Gets and validates a filename
egsub

Global substitute of expression using regular expressions
GString$getBuiltinUsername

Gets the username of the user running R
Arguments$getIntegers

Coerces to a integer vector and validates
inAnyInterval.numeric

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

Reads a single column from file in table format
Java$readByte

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

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

Validates the compiled lines