Learn R Programming

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

R.utils (version 1.5.2)

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.5.2

License

LGPL (>= 2.1)

Maintainer

Henrik Bengtsson

Last Published

September 16th, 2010

Functions in R.utils (1.5.2)

setMaxValue.ProgressBar

Sets maximum value
setOption.Options

Sets an option
readByte.Java

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

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

Class for applicational settings
writeInt.Java

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

Static class to query information about the system
Assert

The Assert class
intToBin

Converts an integer to a binary/octal/hexadecimal number
R.utils-package

Package R.utils
asInt.Java

Converts an numeric to a Java integer
convertComment.VComments

Converts a verbose comment to R code
as.logical.Verbose

Gets a logical value of this object
mergeIntervals.numeric

Merges intervals
seqToHumanReadable

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

Creates a vector of column classes used for tabular reading
copyDirectory

Copies a directory
isEof.connection

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

Preprocess a vector of code lines
isDone.ProgressBar

Checks if progress bar is completed
devNew

Opens a new device
getBuiltinDate.GString

Gets the current date
as.character.Options

Returns a character string version of this object
createWindowsShortcut

Creates a Microsoft Windows Shortcut (.lnk file)
equals.Options

Checks if this object is equal to another Options object
findGhostscript.System

Searches for the ghostview binary on the current system
equals.Verbose

Checks if this object is equal to another
getAbsolutePath

Gets the absolute pathname string
MultiVerbose

A Verbose class ignoring everything
Arguments

Static class to validate and process arguments
mapToIntervals.numeric

Maps values to intervals
reset.VComments

Resets a VComments compiler
dataFrame

Allocates a data frame with given column classes
GString

Character string with advanced substitutions
as.character.GString

Gets the processed character string
setValue.ProgressBar

Sets current value
Sys.setenv

Sys.setenv
devSetLabel

Sets the label of a device
devOff

Closes a device
Java

Static class for Java related methods
Options

The Options class
detachPackage

Detaches a packages by name
enter.Verbose

Writes a message and indents the following output
isScalar.Assert

Static method asserting thatan object is a single value
as.character.ProgressBar

Gets a string description of the progress bar
VComments

The VComments class
loadAnywhere.Settings

Loads settings from file
asByte.Java

Converts a numeric to a Java byte
SmartComments

Abstract class SmartComments
extract.array

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

Writes a message and unindents the following output
cat.Verbose

Concatenates and prints objects if above threshold
TextStatusBar

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

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

Converts vector indices to array indices
capture.Verbose

Captures output of a function
callHooks.function

Call hook functions
getVector.Arguments

Validates a vector
getRaw.GString

Gets the unprocessed GString
FileProgressBar

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

Coerces to a integer vector and validates
getBuiltinDatetime.GString

Gets the current date and time
getUsername.System

Retrieves the name of the user running R
getThreshold.Verbose

Gets current verbose threshold
NullVerbose

A Verbose class ignoring everything
filePath

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

Checks if an option exists
downloadFile.character

Downloads a file
ProgressBar

Provides text based counting progress bar
callHooks

Call hook functions by hook name
Non-documented objects

Non-documented objects
commandArgs

Extract Command Line Arguments
getBuiltinRhome.GString

Gets the path where R is installed
devDone

Closes an on-screen (interactive) device
inAnyInterval.numeric

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

EPS graphics device
setLabel.TextStatusBar

Sets the value of a label
inherits.Assert

Static method asserting that an object inherits from of a certain class
getBuiltinUsername.GString

Gets the username of the user running R
devSet

Activates a device
fileAccess

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

Gets a readable pathname
isUrl

Checks if one or several pathnames is URLs
copyFile

Copies a file safely
getRelativePath

Gets the relative pathname relative to a directory
getBuiltinPid.GString

Gets the process id of the current R session
evaluate.Verbose

Evaluates a function and prints its results if above threshold
getBuiltinOs.GString

Gets the operating system of the running machine
getTimestampFormat.Verbose

Gets the default timestamp format
getOption.Options

Gets an option
getNumerics.Arguments

Coerces to a numeric vector and validates
getReadablePathnames.Arguments

Gets a readable pathname
findGraphicsDevice.System

Searches for a working PNG device
getDoubles.Arguments

Coerces to a double vector and validates
flush.TextStatusBar

Flushes the output
gzip

Gzip/Gunzip a file
loadObject

Method to load object from a file or a connection
isFile

Checks if the file specification is a file
getLeaves.Options

Gets all (non-list) options in a flat list
more.Verbose

Creates a cloned instance with a lower threshold
relibrary

Reloads a package
off.Verbose

Turn off the output
nbrOfOptions.Options

Gets the number of options set
png2

A PNG device for Bitmap Files via GhostScript
asLong.Java

Converts a numeric to a Java long
countLines

Counts the number of lines in a text file
newline.Verbose

Writes one or several empty lines
addFinalizerToLast

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

Checks if a device is open or not
Verbose

Class to writing verbose messages to a connection or file
findSourceTraceback

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

Resets recorded warnings
convertComment.SmartComments

Converts a single smart comment to R code
as.character.Verbose

Returns a character string version of this object
setTicks.ProgressBar

Sets values for which ticks should be visible
getIndices.Arguments

Coerces to a integer vector and validates
getBuiltinTime.GString

Gets the current time
subplots

Creates a grid of subplots
attachLocally.list

Assigns an objects elements locally
getHostname.System

Retrieves the computer name of the current host
whichVector.logical

Identifies TRUE elements in a logical vector
less.Verbose

Creates a cloned instance with a higher threshold
lastModified

Gets the time when the file was last modified
finalizeSession

Function to call for finalizing the R session
getVariableValue.GString

Gets a variable value given a name and attributes
getVerbose.Arguments

Coerces to Verbose object
as.double.Verbose

Gets a numeric value of this object
promptAndSave.Settings

Prompt user to save modified settings
reassignInPackage

Re-assigns a new value to an existing object in a loaded package
update.ProgressBar

Updates progress bar
check.Assert

Static method asserting that a generic condition is true
isDirectory

Checks if the file specification is a directory
setLabels.TextStatusBar

Sets new values of given labels
popMessage.TextStatusBar

Adds a message above the status bar
intervalsToSeq.matrix

Generates a vector of indices from a matrix of intervals
asShort.Java

Converts a numeric to a Java short
names.Options

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

Checks if a package is loaded or not
print.Verbose

Prints objects if above threshold
printf.Verbose

Formats and prints object if above threshold
readWindowsShortcut

Reads a Microsoft Windows Shortcut (.lnk file)
getBuiltinRversion.GString

Gets the current R version
updateLabels.TextStatusBar

Sets the new values of given labels and updates the status bar
header.Verbose

Writes a header
str.Verbose

Prints the structure of an object if above threshold
readUTF.Java

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

Bunzip a file
getLabel.TextStatusBar

Gets the current value of a label
parseDebian.System

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

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

Static method asserting thatan object is a matrix
setDefaultLevel.Verbose

Sets the current default verbose level
parse.GString

Parses a GString
readRdHelp

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

Reads a single column from file in table format
isAbsolutePath

Checks if this pathname is absolute
insert

Insert values to a vector at certain positions
seqToIntervals

Gets all contigous intervals of a vector of indices
listDirectory

Gets the file names in the directory
devGetLabel

Gets the label of a device
print.GString

Prints the processed GString
isOpen.character

Checks if there is an open connection to a file
reset.SmartComments

Resets a SmartComments compiler
on.Verbose

Turn on the output
reset.ProgressBar

Reset progress bar
readShort.Java

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

Checks if the output is on
onGarbageCollect

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

Pushes the current indentation state of the Verbose object
setProgress.ProgressBar

Sets current progress
writeUTF.Java

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

Reads a file in table format
remove.FileProgressBar

Removes the progress file for a file progress bar
readInt.Java

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

Turns automatic timestamping on and off
update.TextStatusBar

Updates the status bar (visually)
isPackageInstalled

Checks if a package is installed or not
splitByPattern

Splits a single character string by pattern
createLink

Creates a link to a file or a directory
validate.VComments

Validates the compiled lines
isVisible.NullVerbose

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

Displays the contents of a text file with line numbers and more
wrap.array

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

Converts a pathname into a URL
writeRaw.MultiVerbose

Writes to each of the Verbose objects
writeBinFragments

Writes binary data to disjoint sections of a connection or a file
newline.TextStatusBar

Writes a newline
writeRaw.Verbose

Writes objects if above threshold
sourceDirectory

Sources files recursively to either local or global environment
update.FileProgressBar

Updates file progress bar
parse.SmartComments

Parses one single smart comment
unwrap.array

Unwrap an array, matrix or a vector to an array of more dimensions
setThreshold.Verbose

Sets verbose threshold
isZero

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

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

Saves an object to a file or a connection
validate.SmartComments

Validates the compiled lines
touchFile

Updates the timestamp of a file
warnings.Verbose

Outputs any warnings recorded
writeShort.Java

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

Saves settings to file
str.Options

Prints the structure of the options
sourceTo

Parses and evaluates code from a file or a connection
ruler.Verbose

Writes a ruler
setStepLength.ProgressBar

Sets default step length
setTimestampFormat.Verbose

Sets the default timestamp format
timestamp.Verbose

Writes a timestamp
summary.Verbose

Generates a summary of an object if above threshold
writeRaw.NullVerbose

All output methods
toCamelCase

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

Executes a function call with option to ignore unused arguments
dimNA< -

Sets the dimension of an object with the option to infer one dimension autmatically
getCharacters.Arguments

Coerces to a character vector and validates
getEnvironment.Arguments

Gets an existing environment
isVisible.Verbose

Checks if a certain verbose level will be shown or not
getLoadedPathname.Settings

Gets the pathname of the settings file loaded
lapply.MultiVerbose

Applies a function to each of the Verbose objects
increase.ProgressBar

Increases (steps) progress bar
readBinFragments

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

Removes a directory
as.character.binmode

Converts a binary/octal/hexadecimal number into a string
as.list.Options

Gets a list representation of the options
printf

C-style formatted output
currentTimeMillis.System

Get the current time in milliseconds
patchCode

Patches installed and loaded packages and more
getBuiltinHostname.GString

Gets the hostname of the system running R
LComments

The LComments class
isVector.Assert

Static method asserting thatan object is a vector
hasUrlProtocol

Checks if one or several pathnames has a URL protocol
findSettings.Settings

Searches for the settings file in one or several directories
getBarString.ProgressBar

Gets the progress bar string to be displayed
devList

Lists the indices of the open devices named by their labels
getRegularExpression.Arguments

Gets a valid regular expression pattern
jpeg2

A JPEG device for Bitmap Files via GhostScript
mkdirs

Creates a directory including any necessary but nonexistent parent directories
getLogicals.Arguments

Coerces to a logical vector and validates
capitalize

Capitalizes/decapitalizes each character string in a vector
stext

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

Method to load objects to a new environment
isModified.Settings

Checks if settings has been modified compared to whats on file
openBrowser.System

Opens an HTML document using the OS default HTML browser
getParent

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

Gets a writable pathname
isOn.NullVerbose

Checks if the output is on