Learn R Programming

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

R.utils (version 1.4.0)

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

226,490

Version

1.4.0

License

LGPL (>= 2.1)

Maintainer

Henrik Bengtsson

Last Published

March 26th, 2010

Functions in R.utils (1.4.0)

Verbose

Class to writing verbose messages to a connection or file
asByte.Java

Converts a numeric to a Java byte
displayCode

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

Activates a device
asInt.Java

Converts an numeric to a Java integer
equals.Verbose

Checks if this object is equal to another
newline.Verbose

Writes one or several empty lines
Sys.setenv

Sys.setenv
isDirectory

Checks if the file specification is a directory
devIsOpen

Checks if a device is open or not
fileAccess

Checks the permission of a file or a directory
dataFrame

Allocates a data frame with given column classes
getThreshold.Verbose

Gets current verbose threshold
less.Verbose

Creates a cloned instance with a higher threshold
lapply.MultiVerbose

Applies a function to each of the Verbose objects
as.character.ProgressBar

Gets a string description of the progress bar
LComments

The LComments class
as.character.Options

Returns a character string version of this object
devDone

Closes an on-screen (interactive) device
dimNA< -

Sets the dimension of an object with the option to infer one dimension autmatically
reset.SmartComments

Resets a SmartComments compiler
capture.Verbose

Captures output of a function
convertComment.VComments

Converts a verbose comment to R code
getInstanceOf.Arguments

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

Class for applicational settings
Options

The Options class
as.logical.Verbose

Gets a logical value of this object
addFinalizerToLast

Modifies .Last() to call 'finalizeSession()
reset.ProgressBar

Reset progress bar
findGhostscript.System

Searches for the ghostview binary on the current system
saveAnywhere.Settings

Saves settings to file
newline.TextStatusBar

Writes a newline
finalizeSession

Function to call for finalizing the R session
saveObject

Saves an object to a file or a connection
onGarbageCollect

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

Generates a vector of indices from a matrix of intervals
check.Assert

Static method asserting that a generic condition is true
gzip

Gzip/Gunzip a file
getBuiltinPid.GString

Gets the process id of the current R session
createLink

Creates a link to a file or a directory
VComments

The VComments class
commandArgs

Extract Command Line Arguments
convertComment.SmartComments

Converts a single smart comment to R code
doCall

Executes a function call with option to ignore unused arguments
getIndices.Arguments

Coerces to a integer vector and validates
callHooks.function

Call hook functions
copyDirectory

Copies a directory
subplots

Creates a grid of subplots
Assert

The Assert class
isZero

Checks if a value is (close to) zero or not
as.double.Verbose

Gets a numeric value of this object
getTimestampFormat.Verbose

Gets the default timestamp format
getVerbose.Arguments

Coerces to Verbose object
callHooks

Call hook functions by hook name
asShort.Java

Converts a numeric to a Java short
getBuiltinDatetime.GString

Gets the current date and time
Arguments

Static class to validate and process arguments
getWritablePathname.Arguments

Gets a writable pathname
getIntegers.Arguments

Coerces to a integer vector and validates
getRelativePath

Gets the relative pathname relative to a directory
listDirectory

Gets the file names in the directory
isVisible.Verbose

Checks if a certain verbose level will be shown or not
as.list.Options

Gets a list representation of the options
isFile

Checks if the file specification is a file
readInt.Java

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

Checks if a package is installed or not
mkdirs

Creates a directory including any necessary but nonexistent parent directories
NullVerbose

A Verbose class ignoring everything
copyFile

Copies a file safely
getEnvironment.Arguments

Gets an existing environment
FileProgressBar

A progress bar that sets the size of a file accordingly
isScalar.Assert

Static method asserting thatan object is a single value
reassignInPackage

Re-assigns a new value to an existing object in a loaded package
getVector.Arguments

Validates a vector
getNumerics.Arguments

Coerces to a numeric vector and validates
capitalize

Capitalizes/decapitalizes each character string in a vector
mapToIntervals.numeric

Maps values to intervals
removeDirectory

Removes a directory
extract.array

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

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

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

Character string with advanced substitutions
off.Verbose

Turn off the output
findSettings.Settings

Searches for the settings file in one or several directories
System

Static class to query information about the system
currentTimeMillis.System

Get the current time in milliseconds
nbrOfOptions.Options

Gets the number of options set
flush.TextStatusBar

Flushes the output
findGraphicsDevice.System

Searches for a working PNG device
openBrowser.System

Opens an HTML document using the OS default HTML browser
getBuiltinRhome.GString

Gets the path where R is installed
ProgressBar

Provides text based counting progress bar
MultiVerbose

A Verbose class ignoring everything
writeRaw.NullVerbose

All output methods
parse.GString

Parses a GString
getBuiltinUsername.GString

Gets the username of the user running R
Non-documented objects

Non-documented objects
getDoubles.Arguments

Coerces to a double vector and validates
setMaxValue.ProgressBar

Sets maximum value
SmartComments

Abstract class SmartComments
png2

A PNG device for Bitmap Files via GhostScript
wrap.array

Reshape an array or a matrix by permuting and/or joining dimensions
getLoadedPathname.Settings

Gets the pathname of the settings file loaded
toUrl

Converts a pathname into a URL
writeInt.Java

Writes a integer (32 bits) to a connection in Java format
attachLocally.list

Assigns an objects elements locally
readUTF.Java

Reads a Java (UTF-8) formatted string from a connection
names.Options

Gets the full pathname of all (non-list) options
getLeaves.Options

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

Sets the label of a device
colClasses

Creates a vector of column classes used for tabular reading
getReadablePathnames.Arguments

Gets a readable pathname
devNew

Opens a new device
on.Verbose

Turn on the output
isOpen.character

Checks if there is an open connection to a file
isVisible.NullVerbose

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

Gets the time when the file was last modified
createWindowsShortcut

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

Validates the compiled lines
enter.Verbose

Writes a message and indents the following output
evaluate.Verbose

Evaluates a function and prints its results if above threshold
seqToIntervals

Gets all contigous intervals of a vector of indices
as.character.binmode

Converts a binary/octal/hexadecimal number into a string
compile.SmartComments

Preprocess a vector of code lines
seqToHumanReadable

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

Writes a ruler
exit.Verbose

Writes a message and unindents the following output
setTimestampFormat.Verbose

Sets the default timestamp format
getLabel.TextStatusBar

Gets the current value of a label
update.TextStatusBar

Updates the status bar (visually)
more.Verbose

Creates a cloned instance with a lower threshold
printf.Verbose

Formats and prints object if above threshold
resetWarnings

Resets recorded warnings
getBuiltinHostname.GString

Gets the hostname of the system running R
isMatrix.Assert

Static method asserting thatan object is a matrix
inherits.Assert

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

Reads a Microsoft Windows Shortcut (.lnk file)
sourceDirectory

Sources files recursively to either local or global environment
equals.Options

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

Prints the processed GString
isAbsolutePath

Checks if this pathname is absolute
header.Verbose

Writes a header
update.ProgressBar

Updates progress bar
getAbsolutePath

Gets the absolute pathname string
patchCode

Patches installed and loaded packages and more
sourceTo

Parses and evaluates code from a file or a connection
setOption.Options

Sets an option
jpeg2

A JPEG device for Bitmap Files via GhostScript
setThreshold.Verbose

Sets verbose threshold
readByte.Java

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

Prints the structure of an object if above threshold
TextStatusBar

A status bar at the R prompt that can be updated
getRegularExpression.Arguments

Gets a valid regular expression pattern
increase.ProgressBar

Increases (steps) progress bar
writeRaw.MultiVerbose

Writes to each of the Verbose objects
unwrap.array

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

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

Gets the string of the parent specified by this pathname
setTicks.ProgressBar

Sets values for which ticks should be visible
isOn.NullVerbose

Checks if the output is on
isDone.ProgressBar

Checks if progress bar is completed
getUsername.System

Retrieves the name of the user running R
updateLabels.TextStatusBar

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

Updates file progress bar
isPackageLoaded

Checks if a package is loaded or not
R.utils-package

Package R.utils
loadAnywhere.Settings

Loads settings from file
warnings.Verbose

Outputs any warnings recorded
splitByPattern

Splits a single character string by pattern
isOn.Verbose

Checks if the output is on
as.character.Verbose

Returns a character string version of this object
cat.Verbose

Concatenates and prints objects if above threshold
writeByte.Java

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

Prints the structure of the options
loadToEnv

Method to load objects to a new environment
countLines

Counts the number of lines in a text file
moveInSearchPath

Moves a environment in the search path to another position
relibrary

Reloads a package
writeBinFragments

Writes binary data to disjoint sections of a connection or a file
validate.SmartComments

Validates the compiled lines
setValue.ProgressBar

Sets current value
print.Verbose

Prints objects if above threshold
devOff

Closes a device
whichVector.logical

Identifies TRUE elements in a logical vector
readTable

Reads a file in table format
readBinFragments

Reads binary data from disjoint sections of a connection or a file
timestampOn.Verbose

Turns automatic timestamping on and off
eps

EPS graphics device
getBarString.ProgressBar

Gets the progress bar string to be displayed
writeRaw.Verbose

Writes objects if above threshold
getBuiltinRversion.GString

Gets the current R version
getRaw.GString

Gets the unprocessed GString
inAnyInterval.numeric

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

Checks if one or several pathnames is URLs
mergeIntervals.numeric

Merges intervals
readShort.Java

Reads a Java formatted short (16 bits) from a connection
remove.FileProgressBar

Removes the progress file for a file progress bar
setLabels.TextStatusBar

Sets new values of given labels
arrayIndex

Converts vector indices to array indices
as.character.GString

Gets the processed character string
asLong.Java

Converts a numeric to a Java long
findSourceTraceback

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

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

Bunzip a file
getBuiltinDate.GString

Gets the current date
getBuiltinTime.GString

Gets the current time
getOption.Options

Gets an option
getLogicals.Arguments

Coerces to a logical vector and validates
hasOption.Options

Checks if an option exists
isModified.Settings

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

Adds a message above the status bar
setStepLength.ProgressBar

Sets default step length
loadObject

Method to load object from a file or a connection
isVector.Assert

Static method asserting thatan object is a vector
parse.SmartComments

Parses one single smart comment
setDefaultLevel.Verbose

Sets the current default verbose level
touchFile

Updates the timestamp of a file
setLabel.TextStatusBar

Sets the value of a label
getHostname.System

Retrieves the computer name of the current host
writeUTF.Java

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

Static class for Java related methods
detachPackage

Detaches a packages by name
devGetLabel

Gets the label of a device
getBuiltinOs.GString

Gets the operating system of the running machine
onSessionExit

Registers a function to be called when the R session finishes
parseDebian.System

Parses a string, file or connection for Debian formatted parameters
summary.Verbose

Generates a summary of an object if above threshold
readTableIndex

Reads a single column from file in table format
toCamelCase

Converts a string of words into a merged camel-cased word
writeShort.Java

Writes a short (16 bits) to a connection in Java format
getCharacters.Arguments

Coerces to a character vector and validates
getReadablePathname.Arguments

Gets a readable pathname
getVariableValue.GString

Gets a variable value given a name and attributes
insert

Insert values to a vector at certain positions
hasUrlProtocol

Checks if one or several pathnames has a URL protocol
reset.VComments

Resets a VComments compiler
promptAndSave.Settings

Prompt user to save modified settings
setProgress.ProgressBar

Sets current progress
timestamp.Verbose

Writes a timestamp
pushState.Verbose

Pushes the current indentation state of the Verbose object