Learn R Programming

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

R.utils (version 1.9.4)

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

License

LGPL (>= 2.1)

Maintainer

Henrik Bengtsson

Last Published

November 20th, 2011

Functions in R.utils (1.9.4)

setLabels.TextStatusBar

Sets new values of given labels
devOff

Closes a device
setDefaultLevel.Verbose

Sets the current default verbose level
getWritablePathname.Arguments

Gets a writable pathname
setProgress.ProgressBar

Sets current progress
hasUrlProtocol

Checks if one or several pathnames has a URL protocol
isSingle

Identifies all entries that exists exactly ones
readByte.Java

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

Converts a numeric to a Java long
hasOption.Options

Checks if an option exists
timestampOn.Verbose

Turns automatic timestamping on and off
isReplicated

Identifies all entries with replicated values
LComments

The LComments class
System

Static class to query information about the system
attachLocally.list

Assigns an objects elements locally
Java

Static class for Java related methods
cat.Verbose

Concatenates and prints objects if above threshold
copyDirectory

Copies a directory
devList

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

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

Gets the label of a device
getBuiltinOs.GString

Gets the operating system of the running machine
R.utils-package

Package R.utils
convertComment.SmartComments

Converts a single smart comment to R code
callHooks

Call hook functions by hook name
as.list.Options

Gets a list representation of the options
as.character.ProgressBar

Gets a string description of the progress bar
as.double.Verbose

Gets a numeric value of this object
asShort.Java

Converts a numeric to a Java short
TextStatusBar

A status bar at the R prompt that can be updated
callHooks.function

Call hook functions
asInt.Java

Converts an numeric to a Java integer
as.character.Options

Returns a character string version of this object
FileProgressBar

A progress bar that sets the size of a file accordingly
Sys.setenv

Sys.setenv
devNew

Opens a new device
Assert

The Assert class
dataFrame

Allocates a data frame with given column classes
Verbose

Class to writing verbose messages to a connection or file
findGraphicsDevice.System

Searches for a working PNG device
convertComment.VComments

Converts a verbose comment to R code
getBuiltinRversion.GString

Gets the current R version
evalCapture

Evaluates an expression and captures the code and/or the output
asByte.Java

Converts a numeric to a Java byte
as.character.Verbose

Returns a character string version of this object
getBarString.ProgressBar

Gets the progress bar string to be displayed
getIndices.Arguments

Coerces to a integer vector and validates
getLoadedPathname.Settings

Gets the pathname of the settings file loaded
getAbsolutePath

Gets the absolute pathname string
getBuiltinHostname.GString

Gets the hostname of the system running R
compile.SmartComments

Preprocess a vector of code lines
GString

Character string with advanced substitutions
check.Assert

Static method asserting that a generic condition is true
getDoubles.Arguments

Coerces to a double vector and validates
header.Verbose

Writes a header
env

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

Creates a vector of column classes used for tabular reading
doCall

Executes a function call with option to ignore unused arguments
createWindowsShortcut

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

Checks if this object is equal to another
as.character.binmode

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

Copies a file safely
createFileAtomically

Creates a file atomically
inAnyInterval.numeric

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

Activates a device
devEval

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

Gzip/Gunzip a file
equals.Options

Checks if this object is equal to another Options object
isVisible.NullVerbose

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

Appends a temporary suffix to the pathname
SmartComments

Abstract class SmartComments
commandArgs

Extract Command Line Arguments
Options

The Options class
exit.Verbose

Writes a message and unindents the following output
Settings

Class for applicational settings
getVariableValue.GString

Gets a variable value given a name and attributes
capture.Verbose

Captures output of a function
getEnvironment.Arguments

Gets an existing environment
ProgressBar

Provides text based counting progress bar
isOn.Verbose

Checks if the output is on
getBuiltinDate.GString

Gets the current date
dimNA< -

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

Downloads a file
NullVerbose

A Verbose class ignoring everything
devSetLabel

Sets the label of a device
fileAccess

Checks the permission of a file or a directory
isUrl

Checks if one or several pathnames is URLs
VComments

The VComments class
countLines

Counts the number of lines in a text file
loadObject

Method to load object from a file or a connection
displayCode

Displays the contents of a text file with line numbers and more
getLabel.TextStatusBar

Gets the current value of a label
lastModified

Gets the time when the file was last modified
eps

EPS graphics device
arrayIndex

Converts vector indices to array indices
remove.FileProgressBar

Removes the progress file for a file progress bar
devIsOpen

Checks if a device is open or not
lapply.MultiVerbose

Applies a function to each of the Verbose objects
getReadablePathname.Arguments

Gets a readable pathname
devDone

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

Insert values to a vector at certain positions
getBuiltinTime.GString

Gets the current time
isVisible.Verbose

Checks if a certain verbose level will be shown or not
getBuiltinDatetime.GString

Gets the current date and time
isModified.Settings

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

A Verbose class ignoring everything
evalWithTimeout

Evaluate an R expression and interrupts it if it takes too long
TimeoutException

TimeoutException represents timeout errors
openBrowser.System

Opens an HTML document using the OS default HTML browser
findGhostscript.System

Searches for the ghostview binary on the current system
createLink

Creates a link to a file or a directory
getRaw.GString

Gets the unprocessed GString
getBuiltinRhome.GString

Gets the path where R is installed
finalizeSession

Function to call for finalizing the R session
evaluate.Verbose

Evaluates a function and prints its results if above threshold
detachPackage

Detaches a packages by name
reset.ProgressBar

Reset progress bar
mergeIntervals.numeric

Merges intervals
filePath

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

Capitalizes/decapitalizes each character string in a vector
readWindowsShortcut

Reads a Microsoft Windows Shortcut (.lnk file)
getRegularExpression.Arguments

Gets a valid regular expression pattern
getBuiltinUsername.GString

Gets the username of the user running R
intToBin

Converts an integer to a binary/octal/hexadecimal number
getHostname.System

Retrieves the computer name of the current host
getThreshold.Verbose

Gets current verbose threshold
subplots

Creates a grid of subplots
resample

Sample values from a set of elements
on.Verbose

Turn on the output
findSettings.Settings

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

Sets the new values of given labels and updates the status bar
inherits.Assert

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

Checks if progress bar is completed
intervalsToSeq.matrix

Generates a vector of indices from a matrix of intervals
toUrl

Converts a pathname into a URL
onSessionExit

Registers a function to be called when the R session finishes
nbrOfOptions.Options

Gets the number of options set
getMessage.TimeoutException

Gets the message of the exception
printf

C-style formatted output
getCharacters.Arguments

Coerces to a character vector and validates
writeBinFragments

Writes binary data to disjoint sections of a connection or a file
isScalar.Assert

Static method asserting thatan object is a single value
flush.TextStatusBar

Flushes the output
jpeg2

A JPEG device for Bitmap Files via GhostScript
enter.Verbose

Writes a message and indents the following output
seqToHumanReadable

Gets a short human readable string representation of an vector of indices
getOption.Options

Gets an option
getNumerics.Arguments

Coerces to a numeric vector and validates
isPackageInstalled

Checks if a package is installed or not
update.FileProgressBar

Updates file progress bar
mapToIntervals.numeric

Maps values to intervals
relibrary

Reloads a package
reassignInPackage

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

Creates a cloned instance with a higher threshold
timestamp.Verbose

Writes a timestamp
readTableIndex

Reads a single column from file in table format
loadToEnv

Method to load objects to a new environment
warnings.Verbose

Outputs any warnings recorded
seqToIntervals

Gets all contigous intervals of a vector of indices
writeRaw.NullVerbose

All output methods
isDirectory

Checks if the file specification is a directory
names.Options

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

Drops a backup suffix from the backup pathname
print.Verbose

Prints objects if above threshold
parse.SmartComments

Parses one single smart comment
patchCode

Patches installed and loaded packages and more
pushState.Verbose

Pushes the current indentation state of the Verbose object
removeDirectory

Removes a directory
promptAndSave.Settings

Prompt user to save modified settings
readBinFragments

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

Sets a option in R
setTimestampFormat.Verbose

Sets the default timestamp format
isPackageLoaded

Checks if a package is loaded or not
renameFile

Renames a file safely
isZero

Checks if a value is (close to) zero or not
setLabel.TextStatusBar

Sets the value of a label
getUsername.System

Retrieves the name of the user running R
setMaxValue.ProgressBar

Sets maximum value
resetWarnings

Resets recorded warnings
isMatrix.Assert

Static method asserting thatan object is a matrix
popMessage.TextStatusBar

Adds a message above the status bar
readUTF.Java

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

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

Writes a ruler
popTemporaryFile

Drops a temporary suffix from the temporary pathname
str.Options

Prints the structure of the options
setTicks.ProgressBar

Sets values for which ticks should be visible
findSourceTraceback

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

Gets the on R CMD check if the current R session was launched by it
getLogicals.Arguments

Coerces to a logical vector and validates
more.Verbose

Creates a cloned instance with a lower threshold
pushBackupFile

Appends a backup suffix to the pathname
splitByPattern

Splits a single character string by pattern
setValue.ProgressBar

Sets current value
saveAnywhere.Settings

Saves settings to file
reset.SmartComments

Resets a SmartComments compiler
stext

Writes text in the margin along the sides of a plot
getVerbose.Arguments

Coerces to Verbose object
isAbsolutePath

Checks if this pathname is absolute
hpaste

Concatenating vectors into human-readable strings
parseDebian.System

Parses a string, file or connection for Debian formatted parameters
getLeaves.Options

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

Prints the structure of an object if above threshold
increase.ProgressBar

Increases (steps) progress bar
listDirectory

Gets the file names in the directory
readTable

Reads a file in table format
print.GString

Prints the processed GString
readRdHelp

Reads one or more Rd help files in a certain format
update.TextStatusBar

Updates the status bar (visually)
reset.VComments

Resets a VComments compiler
validate.VComments

Validates the compiled lines
isOn.NullVerbose

Checks if the output is on
whichVector.logical

Identifies TRUE elements in a logical vector
writeByte.Java

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

Generates a summary of an object if above threshold
setOption.Options

Sets an option
saveObject

Saves an object to a file or a connection
unwrap.array

Unwrap an array, matrix or a vector to an array of more dimensions
Non-documented objects

Non-documented objects
currentTimeMillis.System

Get the current time in milliseconds
wrap.array

Reshape an array or a matrix by permuting and/or joining dimensions
writeDataFrame.data.frame

Writes a data.frame to tabular text file
isOpen.character

Checks if there is an open connection to a file
sourceTo

Parses and evaluates code from a file or a connection
validate.SmartComments

Validates the compiled lines
newline.Verbose

Writes one or several empty lines
getVector.Arguments

Validates a vector
onGarbageCollect

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

Gets a logical value of this object
getBuiltinPid.GString

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

Gets the default timestamp format
writeInt.Java

Writes a integer (32 bits) to a connection in Java format
update.ProgressBar

Updates progress bar
parse.GString

Parses a GString
sourceDirectory

Sources files recursively to either local or global environment
as.character.GString

Gets the processed character string
devOptions

Gets the default device options
setThreshold.Verbose

Sets verbose threshold
isVector.Assert

Static method asserting thatan object is a vector
loadAnywhere.Settings

Loads settings from file
newline.TextStatusBar

Writes a newline
off.Verbose

Turn off the output
mkdirs

Creates a directory including any necessary but nonexistent parent directories
writeRaw.MultiVerbose

Writes to each of the Verbose objects
writeRaw.Verbose

Writes objects if above threshold
moveInSearchPath

Moves a environment in the search path to another position
readShort.Java

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

A PNG device for Bitmap Files via GhostScript
toCamelCase

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

Updates the timestamp of a file
writeUTF.Java

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

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

Checks if the file specification is a file
getReadablePathnames.Arguments

Gets a readable pathname
Arguments

Static class to validate and process arguments
bunzip2

Bunzip a file
extract.array

Extract a subset of an array, matrix or a vector with unknown dimensions
getInstanceOf.Arguments

Gets an instance of the object that is of a particular class
getIntegers.Arguments

Coerces to a integer vector and validates
getParent

Gets the string of the parent specified by this pathname
getRelativePath

Gets the relative pathname relative to a directory
isEof.connection

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

Formats and prints object if above threshold
setStepLength.ProgressBar

Sets default step length
toEPS

Methods for creating image files of a specific format