Learn R Programming

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

R.utils (version 1.9.9)

Various programming utilities

Description

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

Copy Link

Version

Install

install.packages('R.utils')

Monthly Downloads

171,037

Version

1.9.9

License

LGPL (>= 2.1)

Maintainer

Henrik Bengtsson

Last Published

January 12th, 2012

Functions in R.utils (1.9.9)

Settings

Class for applicational settings
TimeoutException

TimeoutException represents timeout errors
Assert

The Assert class
as.double.Verbose

Gets a numeric value of this object
createLink

Creates a link to a file or a directory
asInt.Java

Converts an numeric to a Java integer
compile.SmartComments

Preprocess a vector of code lines
Non-documented objects

Non-documented objects
getReadablePathnames.Arguments

Gets a readable pathname
convertComment.VComments

Converts a verbose comment to R code
Verbose

Class to writing verbose messages to a connection or file
as.character.binmode

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

Returns a character string version of this object
copyDirectory

Copies a directory
MultiVerbose

A Verbose class ignoring everything
currentTimeMillis.System

Get the current time in milliseconds
R.utils-package

Package R.utils
GString

Character string with advanced substitutions
cat.Verbose

Concatenates and prints objects if above threshold
colClasses

Creates a vector of column classes used for tabular reading
FileProgressBar

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

Gets an instance of the object that is of a particular class
attachLocally.list

Assigns an objects elements locally
dataFrame

Allocates a data frame with given column classes
LComments

The LComments class
addFinalizerToLast

Modifies .Last() to call 'finalizeSession()
equals.Options

Checks if this object is equal to another Options object
getBuiltinTime.GString

Gets the current time
VComments

The VComments class
devSetLabel

Sets the label of a device
displayCode

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

Opens a new device
getBuiltinRversion.GString

Gets the current R version
isMatrix.Assert

Static method asserting thatan object is a matrix
isPackageInstalled

Checks if a package is installed or not
getTimestampFormat.Verbose

Gets the default timestamp format
devEval

Opens a new device, evaluate (graphing) code, and closes device
bunzip2

Bunzip a file
Options

The Options class
as.character.GString

Gets the processed character string
isVisible.Verbose

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

Static class for Java related methods
countLines

Counts the number of lines in a text file
getBarString.ProgressBar

Gets the progress bar string to be displayed
eps

EPS graphics device
nbrOfOptions.Options

Gets the number of options set
devGetLabel

Gets the label of a device
getBuiltinUsername.GString

Gets the username of the user running R
getRaw.GString

Gets the unprocessed GString
intToBin

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

Static class to validate and process arguments
getIndices.Arguments

Coerces to a integer vector and validates
SmartComments

Abstract class SmartComments
promptAndSave.Settings

Prompt user to save modified settings
saveObject

Saves an object to a file or a connection
Sys.setenv

Sys.setenv
evalCapture

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

A Verbose class ignoring everything
as.character.ProgressBar

Gets a string description of the progress bar
getAbsolutePath

Gets the absolute pathname string
TextStatusBar

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

Gets the time when the file was last modified
getNumerics.Arguments

Coerces to a numeric vector and validates
intervalsToSeq.matrix

Generates a vector of indices from a matrix of intervals
isReplicated

Identifies all entries with replicated values
devSet

Activates a device
doCall

Executes a function call with option to ignore unused arguments
downloadFile.character

Downloads a file
getBuiltinPid.GString

Gets the process id of the current R session
asByte.Java

Converts a numeric to a Java byte
devOff

Closes a device
getLoadedPathname.Settings

Gets the pathname of the settings file loaded
setProgress.ProgressBar

Sets current progress
findSettings.Settings

Searches for the settings file in one or several directories
str.Options

Prints the structure of the options
getBuiltinDate.GString

Gets the current date
loadToEnv

Method to load objects to a new environment
enter.Verbose

Writes a message and indents the following output
devList

Lists the indices of the open devices named by their labels
devDone

Closes an open device unless it is a on-screen (interactive) device
getCharacters.Arguments

Coerces to a character vector and validates
getIntegers.Arguments

Coerces to a integer vector and validates
setThreshold.Verbose

Sets verbose threshold
getVector.Arguments

Validates a vector
hasOption.Options

Checks if an option exists
detachPackage

Detaches a packages by name
createFileAtomically

Creates a file atomically
inAnyInterval.numeric

Checks if a set of values are inside one or more intervals
getEnvironment.Arguments

Gets an existing environment
devOptions

Gets the default device options
System

Static class to query information about the system
evaluate.Verbose

Evaluates a function and prints its results if above threshold
getVerbose.Arguments

Coerces to Verbose object
isOn.Verbose

Checks if the output is on
pushTemporaryFile

Appends a temporary suffix to the pathname
summary.Verbose

Generates a summary of an object if above threshold
toEPS

Methods for creating image files of a specific format
capitalize

Capitalizes/decapitalizes each character string in a vector
getOption.Options

Gets an option
isModified.Settings

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

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

Call hook functions by hook name
getMessage.TimeoutException

Gets the message of the exception
convertComment.SmartComments

Converts a single smart comment to R code
inherits.Assert

Static method asserting that an object inherits from of a certain class
setMaxValue.ProgressBar

Sets maximum value
less.Verbose

Creates a cloned instance with a higher threshold
setStepLength.ProgressBar

Sets default step length
getRegularExpression.Arguments

Gets a valid regular expression pattern
env

Creates a new environment, evaluates an expression therein, and returns the environment
getReadablePathname.Arguments

Gets a readable pathname
on.Verbose

Turn on the output
findGhostscript.System

Searches for the ghostview binary on the current system
wrap.array

Reshape an array or a matrix by permuting and/or joining dimensions
as.logical.Verbose

Gets a logical value of this object
queryRCmdCheck

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

A PNG device for Bitmap Files via GhostScript
isZero

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

Checks if the file specification is a directory
exit.Verbose

Writes a message and unindents the following output
getParent

Gets the string of the parent specified by this pathname
devIsOpen

Checks if a device is open or not
findGraphicsDevice.System

Searches for a working PNG device
flush.TextStatusBar

Flushes the output
getRelativePath

Gets the relative pathname relative to a directory
off.Verbose

Turn off the output
mergeIntervals.numeric

Merges intervals
readRdHelp

Reads one or more Rd help files in a certain format
isEof.connection

Checks if the current file position for a connection is at the 'End of File'
getBuiltinDatetime.GString

Gets the current date and time
readByte.Java

Reads a Java formatted byte (8 bits) from a connection
remove.FileProgressBar

Removes the progress file for a file progress bar
touchFile

Updates the timestamp of a file
readUTF.Java

Reads a Java (UTF-8) formatted string from a connection
reset.SmartComments

Resets a SmartComments compiler
asLong.Java

Converts a numeric to a Java long
getLabel.TextStatusBar

Gets the current value of a label
isUrl

Checks if one or several pathnames is URLs
setLabel.TextStatusBar

Sets the value of a label
validate.SmartComments

Validates the compiled lines
onSessionExit

Registers a function to be called when the R session finishes
print.GString

Prints the processed GString
popMessage.TextStatusBar

Adds a message above the status bar
toUrl

Converts a pathname into a URL
isAbsolutePath

Checks if this pathname is absolute
mapToIntervals.numeric

Maps values to intervals
sourceTo

Parses and evaluates code from a file or a connection
isVisible.NullVerbose

Checks if a certain verbose level will be shown or not
getDoubles.Arguments

Coerces to a double vector and validates
ProgressBar

Provides text based counting progress bar
arrayIndex

Converts vector indices to array indices
isVector.Assert

Static method asserting thatan object is a vector
increase.ProgressBar

Increases (steps) progress bar
parseDebian.System

Parses a string, file or connection for Debian formatted parameters
getBuiltinRhome.GString

Gets the path where R is installed
removeDirectory

Removes a directory
popBackupFile

Drops a backup suffix from the backup pathname
seqToIntervals

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

Prints the structure of an object if above threshold
callHooks.function

Call hook functions
unwrap.array

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

Creates a grid of subplots
writeBinFragments

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

Reads a file in table format
reassignInPackage

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

Patches installed and loaded packages and more
evalWithTimeout

Evaluate an R expression and interrupts it if it takes too long
getUsername.System

Retrieves the name of the user running R
timestampOn.Verbose

Turns automatic timestamping on and off
seqToHumanReadable

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

Checks if this object is equal to another
insert

Insert values to a vector at certain positions
validate.VComments

Validates the compiled lines
readInt.Java

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

Writes a timestamp
setOption.Options

Sets an option
update.ProgressBar

Updates progress bar
update.FileProgressBar

Updates file progress bar
saveAnywhere.Settings

Saves settings to file
writeShort.Java

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

Gets current verbose threshold
setLabels.TextStatusBar

Sets new values of given labels
isPackageLoaded

Checks if a package is loaded or not
writeRaw.Verbose

Writes objects if above threshold
getBuiltinOs.GString

Gets the operating system of the running machine
getWritablePathname.Arguments

Gets a writable pathname
printf

C-style formatted output
update.TextStatusBar

Updates the status bar (visually)
writeRaw.NullVerbose

All output methods
fileAccess

Checks the permission of a file or a directory
getLogicals.Arguments

Coerces to a logical vector and validates
lapply.MultiVerbose

Applies a function to each of the Verbose objects
reset.VComments

Resets a VComments compiler
toCamelCase

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

Moves a environment in the search path to another position
openBrowser.System

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

Parses one single smart comment
setTimestampFormat.Verbose

Sets the default timestamp format
copyFile

Copies a file safely
findSourceTraceback

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

Writes a header
relibrary

Reloads a package
warnings.Verbose

Outputs any warnings recorded
listDirectory

Gets the file names in the directory
getBuiltinHostname.GString

Gets the hostname of the system running R
as.character.Options

Returns a character string version of this object
jpeg2

A JPEG device for Bitmap Files via GhostScript
getLeaves.Options

Gets all (non-list) options in a flat list
names.Options

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

Extract Command Line Arguments
splitByPattern

Splits a single character string by pattern
check.Assert

Static method asserting that a generic condition is true
readWindowsShortcut

Reads a Microsoft Windows Shortcut (.lnk file)
sourceDirectory

Sources files recursively to either local or global environment
setValue.ProgressBar

Sets current value
hasUrlProtocol

Checks if one or several pathnames has a URL protocol
resetWarnings

Resets recorded warnings
isOpen.character

Checks if there is an open connection to a file
getHostname.System

Retrieves the computer name of the current host
isScalar.Assert

Static method asserting thatan object is a single value
isSingle

Identifies all entries that exists exactly ones
popTemporaryFile

Drops a temporary suffix from the temporary pathname
newline.TextStatusBar

Writes a newline
parse.GString

Parses a GString
hpaste

Concatenating vectors into human-readable strings
readTableIndex

Reads a single column from file in table format
print.Verbose

Prints objects if above threshold
pushState.Verbose

Pushes the current indentation state of the Verbose object
updateLabels.TextStatusBar

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

Writes text in the margin along the sides of a plot
isDone.ProgressBar

Checks if progress bar is completed
writeDataFrame.data.frame

Writes a data.frame to tabular text file
loadAnywhere.Settings

Loads settings from file
ruler.Verbose

Writes a ruler
writeUTF.Java

Writes a string to a connection in Java format (UTF-8)
writeRaw.MultiVerbose

Writes to each of the Verbose objects
createWindowsShortcut

Creates a Microsoft Windows Shortcut (.lnk file)
loadObject

Method to load object from a file or a connection
asShort.Java

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

Gets a list representation of the options
capture.Verbose

Captures output of a function
dimNA< -

Sets the dimension of an object with the option to infer one dimension autmatically
extract.array

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

Function to call for finalizing the R session
gzip

Gzip/Gunzip a file
getVariableValue.GString

Gets a variable value given a name and attributes
isFile

Checks if the file specification is a file
more.Verbose

Creates a cloned instance with a lower threshold
mkdirs

Creates a directory including any necessary but nonexistent parent directories
newline.Verbose

Writes one or several empty lines
printf.Verbose

Formats and prints object if above threshold
readBinFragments

Reads binary data from disjoint sections of a connection or a file
whichVector.logical

Identifies TRUE elements in a logical vector
readShort.Java

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

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

Checks if the output is on
pushBackupFile

Appends a backup suffix to the pathname
reset.ProgressBar

Reset progress bar
renameFile

Renames a file safely
setTicks.ProgressBar

Sets values for which ticks should be visible
setDefaultLevel.Verbose

Sets the current default verbose level
writeByte.Java

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

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

Sets a option in R
resample

Sample values from a set of elements