Learn R Programming

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

R.utils (version 1.9.3)

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

192,589

Version

1.9.3

License

LGPL (>= 2.1)

Maintainer

Henrik Bengtsson

Last Published

November 8th, 2011

Functions in R.utils (1.9.3)

Assert

The Assert class
eps

EPS graphics device
Sys.setenv

Sys.setenv
Settings

Class for applicational settings
FileProgressBar

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

Abstract class SmartComments
as.list.Options

Gets a list representation of the options
asInt.Java

Converts an numeric to a Java integer
downloadFile.character

Downloads a file
devDone

Closes an open device unless it is a on-screen (interactive) device
LComments

The LComments class
devSetLabel

Sets the label of a device
hasOption.Options

Checks if an option exists
as.logical.Verbose

Gets a logical value of this object
asByte.Java

Converts a numeric to a Java byte
getRaw.GString

Gets the unprocessed GString
getBuiltinDate.GString

Gets the current date
asShort.Java

Converts a numeric to a Java short
devOptions

Gets the default device options
getBuiltinUsername.GString

Gets the username of the user running R
NullVerbose

A Verbose class ignoring everything
isOn.NullVerbose

Checks if the output is on
devGetLabel

Gets the label of a device
callHooks.function

Call hook functions
commandArgs

Extract Command Line Arguments
isVector.Assert

Static method asserting thatan object is a vector
compile.SmartComments

Preprocess a vector of code lines
getLoadedPathname.Settings

Gets the pathname of the settings file loaded
arrayIndex

Converts vector indices to array indices
isVisible.NullVerbose

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

Concatenating vectors into human-readable strings
createLink

Creates a link to a file or a directory
TimeoutException

TimeoutException represents timeout errors
env

Creates a new environment, evaluates an expression therein, and returns the environment
ProgressBar

Provides text based counting progress bar
increase.ProgressBar

Increases (steps) progress bar
convertComment.VComments

Converts a verbose comment to R code
getBuiltinRversion.GString

Gets the current R version
jpeg2

A JPEG device for Bitmap Files via GhostScript
getBarString.ProgressBar

Gets the progress bar string to be displayed
equals.Verbose

Checks if this object is equal to another
mapToIntervals.numeric

Maps values to intervals
as.character.Verbose

Returns a character string version of this object
isOpen.character

Checks if there is an open connection to a file
doCall

Executes a function call with option to ignore unused arguments
MultiVerbose

A Verbose class ignoring everything
callHooks

Call hook functions by hook name
bunzip2

Bunzip a file
as.character.Options

Returns a character string version of this object
Arguments

Static class to validate and process arguments
as.character.ProgressBar

Gets a string description of the progress bar
Options

The Options class
getBuiltinTime.GString

Gets the current time
isOn.Verbose

Checks if the output is on
System

Static class to query information about the system
devList

Lists the indices of the open devices named by their labels
findGraphicsDevice.System

Searches for a working PNG device
VComments

The VComments class
as.character.binmode

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

Checks if the file specification is a file
loadAnywhere.Settings

Loads settings from file
copyFile

Copies a file safely
lapply.MultiVerbose

Applies a function to each of the Verbose objects
getBuiltinRhome.GString

Gets the path where R is installed
getParent

Gets the string of the parent specified by this pathname
getInstanceOf.Arguments

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

Writes a message and unindents the following output
devIsOpen

Checks if a device is open or not
dataFrame

Allocates a data frame with given column classes
isSingle

Identifies all entries that exists exactly ones
attachLocally.list

Assigns an objects elements locally
popMessage.TextStatusBar

Adds a message above the status bar
getUsername.System

Retrieves the name of the user running R
colClasses

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

Concatenates and prints objects if above threshold
Java

Static class for Java related methods
createFileAtomically

Creates a file atomically
Verbose

Class to writing verbose messages to a connection or file
isDirectory

Checks if the file specification is a directory
fileAccess

Checks the permission of a file or a directory
parseDebian.System

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

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

Checks if this object is equal to another Options object
convertComment.SmartComments

Converts a single smart comment to R code
header.Verbose

Writes a header
asLong.Java

Converts a numeric to a Java long
getBuiltinDatetime.GString

Gets the current date and time
detachPackage

Detaches a packages by name
devEval

Opens a new device, evaluate (graphing) code, and closes device
print.Verbose

Prints objects if above threshold
dimNA< -

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

Gets the processed character string
getEnvironment.Arguments

Gets an existing environment
enter.Verbose

Writes a message and indents the following output
readBinFragments

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

Reads a Microsoft Windows Shortcut (.lnk file)
isMatrix.Assert

Static method asserting thatan object is a matrix
getHostname.System

Retrieves the computer name of the current host
reset.ProgressBar

Reset progress bar
GString

Character string with advanced substitutions
readTable

Reads a file in table format
getIndices.Arguments

Coerces to a integer vector and validates
newline.Verbose

Writes one or several empty lines
seqToHumanReadable

Gets a short human readable string representation of an vector of indices
inAnyInterval.numeric

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

Coerces to a integer vector and validates
loadObject

Method to load object from a file or a connection
nbrOfOptions.Options

Gets the number of options set
stext

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

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

Package R.utils
getDoubles.Arguments

Coerces to a double vector and validates
loadToEnv

Method to load objects to a new environment
readShort.Java

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

Gets all contigous intervals of a vector of indices
isDone.ProgressBar

Checks if progress bar is completed
isAbsolutePath

Checks if this pathname is absolute
setTicks.ProgressBar

Sets values for which ticks should be visible
TextStatusBar

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

Appends a temporary suffix to the pathname
countLines

Counts the number of lines in a text file
sourceDirectory

Sources files recursively to either local or global environment
mergeIntervals.numeric

Merges intervals
isScalar.Assert

Static method asserting thatan object is a single value
extract.array

Extract a subset of an array, matrix or a vector with unknown dimensions
off.Verbose

Turn off the output
queryRCmdCheck

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

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

Closes a device
insert

Insert values to a vector at certain positions
parse.SmartComments

Parses one single smart comment
popBackupFile

Drops a backup suffix from the backup pathname
update.FileProgressBar

Updates file progress bar
update.TextStatusBar

Updates the status bar (visually)
sourceTo

Parses and evaluates code from a file or a connection
createWindowsShortcut

Creates a Microsoft Windows Shortcut (.lnk file)
lastModified

Gets the time when the file was last modified
str.Options

Prints the structure of the options
removeDirectory

Removes a directory
getLabel.TextStatusBar

Gets the current value of a label
devSet

Activates a device
reset.VComments

Resets a VComments compiler
names.Options

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

Reads a single column from file in table format
setLabels.TextStatusBar

Sets new values of given labels
getMessage.TimeoutException

Gets the message of the exception
saveObject

Saves an object to a file or a connection
setValue.ProgressBar

Sets current value
findSourceTraceback

Finds all 'srcfile' objects generated by source() in all call frames
isEof.connection

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

Parses a GString
setProgress.ProgressBar

Sets current progress
reassignInPackage

Re-assigns a new value to an existing object in a loaded package
remove.FileProgressBar

Removes the progress file for a file progress bar
splitByPattern

Splits a single character string by pattern
renameFile

Renames a file safely
unwrap.array

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

Writes binary data to disjoint sections of a connection or a file
openBrowser.System

Opens an HTML document using the OS default HTML browser
displayCode

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

Methods for creating image files of a specific format
readUTF.Java

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

Reads one or more Rd help files in a certain format
writeRaw.NullVerbose

All output methods
warnings.Verbose

Outputs any warnings recorded
on.Verbose

Turn on the output
setTimestampFormat.Verbose

Sets the default timestamp format
findSettings.Settings

Searches for the settings file in one or several directories
newline.TextStatusBar

Writes a newline
ruler.Verbose

Writes a ruler
setOption

Sets a option in R
gzip

Gzip/Gunzip a file
wrap.array

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

Gets the absolute pathname string
filePath

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

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

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

Sets the current default verbose level
findGhostscript.System

Searches for the ghostview binary on the current system
getBuiltinOs.GString

Gets the operating system of the running machine
getCharacters.Arguments

Coerces to a character vector and validates
writeInt.Java

Writes a integer (32 bits) to a connection in Java format
getNumerics.Arguments

Coerces to a numeric vector and validates
setMaxValue.ProgressBar

Sets maximum value
getBuiltinPid.GString

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

Reads a Java formatted int (32 bits) from a connection
getOption.Options

Gets an option
getTimestampFormat.Verbose

Gets the default timestamp format
writeDataFrame.data.frame

Writes a data.frame to tabular text file
flush.TextStatusBar

Flushes the output
getVector.Arguments

Validates a vector
toUrl

Converts a pathname into a URL
validate.SmartComments

Validates the compiled lines
printf.Verbose

Formats and prints object if above threshold
setOption.Options

Sets an option
isModified.Settings

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

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

Writes objects if above threshold
writeUTF.Java

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

Resets recorded warnings
currentTimeMillis.System

Get the current time in milliseconds
resample

Sample values from a set of elements
getWritablePathname.Arguments

Gets a writable pathname
getThreshold.Verbose

Gets current verbose threshold
evalCapture

Evaluates an expression and captures the code and/or the output
timestamp.Verbose

Writes a timestamp
getLogicals.Arguments

Coerces to a logical vector and validates
getRegularExpression.Arguments

Gets a valid regular expression pattern
getLeaves.Options

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

Checks if a package is installed or not
summary.Verbose

Generates a summary of an object if above threshold
printf

C-style formatted output
getVariableValue.GString

Gets a variable value given a name and attributes
copyDirectory

Copies a directory
onSessionExit

Registers a function to be called when the R session finishes
setStepLength.ProgressBar

Sets default step length
whichVector.logical

Identifies TRUE elements in a logical vector
relibrary

Reloads a package
inherits.Assert

Static method asserting that an object inherits from of a certain class
readByte.Java

Reads a Java formatted byte (8 bits) from a connection
getVerbose.Arguments

Coerces to Verbose object
less.Verbose

Creates a cloned instance with a higher threshold
str.Verbose

Prints the structure of an object if above threshold
timestampOn.Verbose

Turns automatic timestamping on and off
isReplicated

Identifies all entries with replicated values
reset.SmartComments

Resets a SmartComments compiler
writeByte.Java

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

Generates a vector of indices from a matrix of intervals
update.ProgressBar

Updates progress bar
writeRaw.MultiVerbose

Writes to each of the Verbose objects
onGarbageCollect

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

Gets the hostname of the system running R
getReadablePathnames.Arguments

Gets a readable pathname
png2

A PNG device for Bitmap Files via GhostScript
popTemporaryFile

Drops a temporary suffix from the temporary pathname
pushBackupFile

Appends a backup suffix to the pathname
pushState.Verbose

Pushes the current indentation state of the Verbose object
validate.VComments

Validates the compiled lines
touchFile

Updates the timestamp of a file
addFinalizerToLast

Modifies .Last() to call 'finalizeSession()
as.double.Verbose

Gets a numeric value of this object
evaluate.Verbose

Evaluates a function and prints its results if above threshold
intToBin

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

Checks if one or several pathnames is URLs
isVisible.Verbose

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

Gets the file names in the directory
moveInSearchPath

Moves a environment in the search path to another position
print.GString

Prints the processed GString
setLabel.TextStatusBar

Sets the value of a label
subplots

Creates a grid of subplots
Non-documented objects

Non-documented objects
capitalize

Capitalizes/decapitalizes each character string in a vector
capture.Verbose

Captures output of a function
check.Assert

Static method asserting that a generic condition is true
devNew

Opens a new device
finalizeSession

Function to call for finalizing the R session
getReadablePathname.Arguments

Gets a readable pathname
hasUrlProtocol

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

Creates a cloned instance with a lower threshold
promptAndSave.Settings

Prompt user to save modified settings
patchCode

Patches installed and loaded packages and more
saveAnywhere.Settings

Saves settings to file
setThreshold.Verbose

Sets verbose threshold
getRelativePath

Gets the relative pathname relative to a directory
writeShort.Java

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