Learn R Programming

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

R.utils (version 1.26.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.26.0

License

LGPL (>= 2.1)

Maintainer

Henrik Bengtsson

Last Published

July 28th, 2013

Functions in R.utils (1.26.0)

evalCapture

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

Method to load objects to a new environment
MultiVerbose

A Verbose class ignoring everything
copyDirectory

Copies a directory
Verbose

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

Concatenates and prints objects if above threshold
NullVerbose

A Verbose class ignoring everything
addFinalizerToLast

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

Static class for Java related methods
env

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

Evaluates a function and prints its results if above threshold
FileProgressBar

A progress bar that sets the size of a file accordingly
mergeIntervals.numeric

Merges intervals
Java$asShort

Converts a numeric to a Java short
System$openBrowser

Opens an HTML document using the OS default HTML browser
compile.SmartComments

Preprocess a vector of code lines
resetWarnings

Resets recorded warnings
detachPackage

Detaches a packages by name
as.character.Options

Returns a character string version of this object
mapToIntervals.numeric

Maps values to intervals
as.character.GString

Gets the processed character string
Settings

Class for applicational settings
arrayIndex

Converts vector indices to array indices
callHooks.function

Call hook functions
Arguments$getRegularExpression

Gets a valid regular expression pattern
as.double.Verbose

Gets a numeric value of this object
Java$asByte

Converts a numeric to a Java byte
intervalsToSeq.matrix

Generates a vector of indices from a matrix of intervals
resample

Sample values from a set of elements
getAbsolutePath

Gets the absolute pathname string
hasOption.Options

Checks if an option exists
gstring

Parses and evaluates a GString into a regular string
VComments

The VComments class
GString$getBuiltinRhome

Gets the path where R is installed
as.list.Options

Gets a list representation of the options
draw.density

Draws a density curve
isDirectory

Checks if the file specification is a directory
Assert

The Assert class
evalWithTimeout

Evaluate an R expression and interrupts it if it takes too long
Non-documented objects

Non-documented objects
SmartComments

Abstract class SmartComments
R.utils-package

Package R.utils
inAnyInterval.numeric

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

Gets a string description of the progress bar
Arguments$getReadablePathname

Gets a readable pathname
cleanup.FileProgressBar

Removes the progress file for a file progress bar
Arguments$getEnvironment

Gets an existing environment
parse.GString

Parses a GString
System$currentTimeMillis

Get the current time in milliseconds
callHooks

Call hook functions by hook name
onSessionExit

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

Gets the file names in the directory
Arguments$getVerbose

Coerces to Verbose object
System$getUsername

Retrieves the name of the user running R
copyFile

Copies a file safely
GString$getBuiltinOs

Gets the operating system of the running machine
isOn.Verbose

Checks if the output is on
System$findGraphicsDevice

Searches for a working PNG device
convertComment.SmartComments

Converts a single smart comment to R code
capture.Verbose

Captures output of a function
getOption.Options

Gets an option
createFileAtomically

Creates a file atomically
System$findGhostscript

Searches for a Ghostview executable on the current system
TextStatusBar

A status bar at the R prompt that can be updated
Settings$findSettings

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

Gets the current time
System$parseDebian

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

Capitalizes/decapitalizes each character string in a vector
gcat

Parses, evaluates and outputs a GString
isEof.connection

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

Gets a readable pathname
moveInSearchPath

Moves a environment in the search path to another position
commandArgs

Extract command-line arguments
colClasses

Creates a vector of column classes used for tabular reading
setLabel.TextStatusBar

Sets the value of a label
setValue.ProgressBar

Sets current value
systemR

Launches another R process from within R
displayCode

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

Checks if one or several pathnames has a URL protocol
GString$getBuiltinHostname

Gets the hostname of the system running R
Arguments$getIndices

Coerces to a integer vector and validates
Arguments$getFilename

Gets and validates a filename
convertComment.VComments

Converts a verbose comment to R code
isZero

Checks if a value is (close to) zero or not
isOn.NullVerbose

Checks if the output is on
GString$getBuiltinPid

Gets the process id of the current R session
str.Options

Prints the structure of the options
Arguments$getInstanceOf

Gets an instance of the object that is of a particular class
enter.Verbose

Writes a message and indents the following output
GString$getBuiltinUsername

Gets the username of the user running R
getRelativePath

Gets the relative pathname relative to a directory
getRaw.GString

Gets the unprocessed GString
as.character.Verbose

Returns a character string version of this object
Arguments

Static class to validate and process arguments
createLink

Creates a link to a file or a directory
isModified.Settings

Checks if settings has been modified compared to whats on file
getBarString.ProgressBar

Gets the progress bar string to be displayed
getParent

Gets the string of the parent specified by this pathname
hpaste

Concatenating vectors into human-readable strings
GString$getBuiltinDatetime

Gets the current date and time
isDone.ProgressBar

Checks if progress bar is completed
isAbsolutePath

Checks if this pathname is absolute
mkdirs

Creates a directory including any necessary but nonexistent parent directories
isPackageLoaded

Checks if a package is loaded or not
saveObject

Saves an object to a file or a connection
gzip

Gzip/Gunzip a file
setStepLength.ProgressBar

Sets default step length
Java$writeInt

Writes a integer (32 bits) to a connection in Java format
dimNA< -

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

Function to call for finalizing the R session
setThreshold.Verbose

Sets verbose threshold
Assert$isMatrix

Static method asserting thatan object is a matrix
doCall

Executes a function call with option to ignore unused arguments
Arguments$getIntegers

Coerces to a integer vector and validates
nbrOfOptions.Options

Gets the number of options set
whichVector.logical

Identifies TRUE elements in a logical vector
as.logical.Verbose

Gets a logical value of this object
Assert$isScalar

Static method asserting thatan object is a single value
Arguments$getLogicals

Coerces to a logical vector and validates
writeDataFrame.data.frame

Writes a data.frame to tabular text file
increase.ProgressBar

Increases (steps) progress bar
pushBackupFile

Appends a backup suffix to the pathname
printf

C-style formatted output
downloadFile.character

Downloads a file
findFiles

Finds one or several files in multiple directories
newline.TextStatusBar

Writes a newline
getMessage.TimeoutException

Gets the message of the exception
readWindowsShortcut

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

Adds a message above the status bar
isReplicated

Identifies all entries with replicated values
GString$getVariableValue

Gets a variable value given a name and attributes
getLeaves.Options

Gets all (non-list) options in a flat list
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
writeRaw.MultiVerbose

Writes to each of the Verbose objects
Java$writeUTF

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

Converts an integer to a binary/octal/hexadecimal number
on.Verbose

Turn on the output
createWindowsShortcut

Creates a Microsoft Windows Shortcut (.lnk file)
GString$getBuiltinDate

Gets the current date
setOption.Options

Sets an option
removeDirectory

Removes a directory
getThreshold.Verbose

Gets current verbose threshold
touchFile

Updates the timestamp of a file
update.TextStatusBar

Updates the status bar (visually)
insert

Insert values to a vector at certain positions
Arguments$getWritablePathname

Gets a writable pathname
cmdArgs

Simple access to parsed command-line arguments
popTemporaryFile

Drops a temporary suffix from the temporary pathname
promptAndSave.Settings

Prompt user to save modified settings
readWindowsShellLink

Reads a Microsoft Windows Shortcut (.lnk file)
reassignInPackage

Re-assigns a new value to an existing object in a loaded package
more.Verbose

Creates a cloned instance with a lower threshold
reset.ProgressBar

Reset progress bar
newline.Verbose

Writes one or several empty lines
print.GString

Prints the processed GString
Java$readByte

Reads a Java formatted byte (8 bits) from a connection
setDefaultLevel.Verbose

Sets the current default verbose level
isFile

Checks if the file specification is a file
popBackupFile

Drops a backup suffix from the backup pathname
patchCode

Patches installed and loaded packages and more
pushTemporaryFile

Appends a temporary suffix to the pathname
isVisible.NullVerbose

Checks if a certain verbose level will be shown or not
getTimestampFormat.Verbose

Gets the default timestamp format
Java$readShort

Reads a Java formatted short (16 bits) from a connection
wrap.array

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

Gets the time when the file was last modified
Java$asLong

Converts a numeric to a Java long
setTicks.ProgressBar

Sets values for which ticks should be visible
readBinFragments

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

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

Renames a file safely
sourceDirectory

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

Checks if a certain verbose level will be shown or not
Java$readUTF

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

Reads a Java formatted int (32 bits) from a connection
str.Verbose

Prints the structure of an object if above threshold
writeBinFragments

Writes binary data to disjoint sections of a connection or a file
equals.Verbose

Checks if this object is equal to another
isOpen.character

Checks if there is an open connection to a file
setTimestampFormat.Verbose

Sets the default timestamp format
getLabel.TextStatusBar

Gets the current value of a label
swapXY.density

Swaps x and y coordinates of a density object
summary.Verbose

Generates a summary of an object if above threshold
reset.VComments

Resets a VComments compiler
exit.Verbose

Writes a message and unindents the following output
update.ProgressBar

Updates progress bar
seqToIntervals

Gets all contigous intervals of a vector of indices
names.Options

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

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

Sets maximum value
toCamelCase

Converts a string of words into a merged camel-cased word
Arguments$getNumerics

Coerces to a numeric vector and validates
parse.SmartComments

Parses one single smart comment
Java$writeShort

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

Turns automatic timestamping on and off
queryRCmdCheck

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

Splits a single character string by pattern
reset.SmartComments

Resets a SmartComments compiler
Java$writeByte

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

Unwrap an array, matrix or a vector to an array of more dimensions
validate.VComments

Validates the compiled lines
stext

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

Checks if a package is installed or not
setProgress.ProgressBar

Sets current progress
updateLabels.TextStatusBar

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

Sets new values of given labels
warnings.Verbose

Outputs any warnings recorded
Arguments$getVector

Validates a vector
Assert$isVector

Static method asserting thatan object is a vector
validate.SmartComments

Validates the compiled lines
Assert$check

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

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

Writes objects if above threshold
isSingle

Identifies all entries that exists exactly ones
toUrl

Converts a pathname into a URL
TimeoutException

TimeoutException represents timeout errors
print.Verbose

Prints objects if above threshold
writeRaw.NullVerbose

All output methods
printf.Verbose

Formats and prints object if above threshold
update.FileProgressBar

Updates file progress bar
setOption

Sets a option in R
less.Verbose

Creates a cloned instance with a higher threshold
loadObject

Method to load object from a file or a connection
ProgressBar

Provides text based counting progress bar
attachLocally.list

Assigns an objects elements locally
fileAccess

Checks the permission of a file or a directory
Arguments$getCharacters

Coerces to a character vector and validates
Assert$inherits

Static method asserting that an object inherits from of a certain class
loadAnywhere.Settings

Loads settings from file
saveAnywhere.Settings

Saves settings to file
seqToHumanReadable

Gets a short human readable string representation of an vector of indices
timestamp.Verbose

Writes a timestamp
subplots

Creates a grid of subplots
System$getHostname

Retrieves the computer name of the current host
eget

Gets a variable by name
Options

The Options class
as.list.MultiVerbose

Gets a list of Verbose objects
Java$asInt

Converts an numeric to a Java integer
LComments

The LComments class
bunzip2

Bunzip a file
countLines

Counts the number of lines in a text file
evaluate.GString

Parses and evaluates a GString
Arguments$getDoubles

Coerces to a double vector and validates
header.Verbose

Writes a header
off.Verbose

Turn off the output
ruler.Verbose

Writes a ruler
readTableIndex

Reads a single column from file in table format
as.character.binmode

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

Static class to query information about the system
dataFrame

Allocates a data frame with given column classes
extract.array

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

Flushes the output
GString$getBuiltinRversion

Gets the current R version
pushState.Verbose

Pushes the current indentation state of the Verbose object
isUrl

Checks if one or several pathnames is URLs
readRdHelp

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

Parses and evaluates code from a file or a connection
tempvar

Gets a unique non-existing temporary variable name
getLoadedPathname.Settings

Gets the pathname of the settings file loaded