Learn R Programming

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

R.utils (version 1.7.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

192,589

Version

1.7.0

License

LGPL (>= 2.1)

Maintainer

Henrik Bengtsson

Last Published

March 14th, 2011

Functions in R.utils (1.7.0)

GString

Character string with advanced substitutions
Java

Static class for Java related methods
dimNA< -

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

Downloads a file
createLink

Creates a link to a file or a directory
FileProgressBar

A progress bar that sets the size of a file accordingly
convertComment.VComments

Converts a verbose comment to R code
dataFrame

Allocates a data frame with given column classes
devIsOpen

Checks if a device is open or not
Settings

Class for applicational settings
isModified.Settings

Checks if settings has been modified compared to whats on file
as.double.Verbose

Gets a numeric value of this object
getLeaves.Options

Gets all (non-list) options in a flat list
getVerbose.Arguments

Coerces to Verbose object
Assert

The Assert class
as.character.Verbose

Returns a character string version of this object
Non-documented objects

Non-documented objects
header.Verbose

Writes a header
TimeoutException

TimeoutException represents timeout errors
capture.Verbose

Captures output of a function
callHooks.function

Call hook functions
check.Assert

Static method asserting that a generic condition is true
isFile

Checks if the file specification is a file
eps

EPS graphics device
setThreshold.Verbose

Sets verbose threshold
detachPackage

Detaches a packages by name
commandArgs

Extract Command Line Arguments
devDone

Closes an on-screen (interactive) device
evalWithTimeout

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

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

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

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

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

Provides text based counting progress bar
isOn.Verbose

Checks if the output is on
displayCode

Displays the contents of a text file with line numbers and more
saveAnywhere.Settings

Saves settings to file
copyDirectory

Copies a directory
countLines

Counts the number of lines in a text file
isUrl

Checks if one or several pathnames is URLs
readUTF.Java

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

The VComments class
exit.Verbose

Writes a message and unindents the following output
getHostname.System

Retrieves the computer name of the current host
getBuiltinRhome.GString

Gets the path where R is installed
findGhostscript.System

Searches for the ghostview binary on the current system
names.Options

Gets the full pathname of all (non-list) options
increase.ProgressBar

Increases (steps) progress bar
createWindowsShortcut

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

Checks if this object is equal to another
timestamp.Verbose

Writes a timestamp
intToBin

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

Coerces to a integer vector and validates
isOn.NullVerbose

Checks if the output is on
on.Verbose

Turn on the output
promptAndSave.Settings

Prompt user to save modified settings
writeRaw.NullVerbose

All output methods
remove.FileProgressBar

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

Updates the status bar (visually)
setTimestampFormat.Verbose

Sets the default timestamp format
cat.Verbose

Concatenates and prints objects if above threshold
fileAccess

Checks the permission of a file or a directory
whichVector.logical

Identifies TRUE elements in a logical vector
isOpen.character

Checks if there is an open connection to a file
TextStatusBar

A status bar at the R prompt that can be updated
warnings.Verbose

Outputs any warnings recorded
LComments

The LComments class
getNumerics.Arguments

Coerces to a numeric vector and validates
isPackageInstalled

Checks if a package is installed or not
isPackageLoaded

Checks if a package is loaded or not
getRelativePath

Gets the relative pathname relative to a directory
doCall

Executes a function call with option to ignore unused arguments
reassignInPackage

Re-assigns a new value to an existing object in a loaded package
findGraphicsDevice.System

Searches for a working PNG device
resetWarnings

Resets recorded warnings
getAbsolutePath

Gets the absolute pathname string
loadAnywhere.Settings

Loads settings from file
as.character.GString

Gets the processed character string
splitByPattern

Splits a single character string by pattern
MultiVerbose

A Verbose class ignoring everything
colClasses

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

Writes a message and indents the following output
print.Verbose

Prints objects if above threshold
getBuiltinRversion.GString

Gets the current R version
mkdirs

Creates a directory including any necessary but nonexistent parent directories
devSet

Activates a device
isDirectory

Checks if the file specification is a directory
asInt.Java

Converts an numeric to a Java integer
Sys.setenv

Sys.setenv
getBuiltinHostname.GString

Gets the hostname of the system running R
getBuiltinPid.GString

Gets the process id of the current R session
NullVerbose

A Verbose class ignoring everything
as.logical.Verbose

Gets a logical value of this object
devOff

Closes a device
SmartComments

Abstract class SmartComments
getBuiltinTime.GString

Gets the current time
getInstanceOf.Arguments

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

Coerces to a logical vector and validates
hasOption.Options

Checks if an option exists
System

Static class to query information about the system
copyFile

Copies a file safely
stext

Writes text in the margin along the sides of a plot
readByte.Java

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

Gets a readable pathname
getDoubles.Arguments

Coerces to a double vector and validates
attachLocally.list

Assigns an objects elements locally
setOption

Sets a option in R
asByte.Java

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

Gets a list representation of the options
callHooks

Call hook functions by hook name
Arguments

Static class to validate and process arguments
getLoadedPathname.Settings

Gets the pathname of the settings file loaded
findSourceTraceback

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

The Options class
currentTimeMillis.System

Get the current time in milliseconds
setProgress.ProgressBar

Sets current progress
str.Options

Prints the structure of the options
getThreshold.Verbose

Gets current verbose threshold
as.character.Options

Returns a character string version of this object
loadToEnv

Method to load objects to a new environment
less.Verbose

Creates a cloned instance with a higher threshold
addFinalizerToLast

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

Updates progress bar
jpeg2

A JPEG device for Bitmap Files via GhostScript
writeBinFragments

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

Gets the string of the parent specified by this pathname
printf.Verbose

Formats and prints object if above threshold
convertComment.SmartComments

Converts a single smart comment to R code
off.Verbose

Turn off the output
devSetLabel

Sets the label of a device
compile.SmartComments

Preprocess a vector of code lines
nbrOfOptions.Options

Gets the number of options set
setLabel.TextStatusBar

Sets the value of a label
getReadablePathnames.Arguments

Gets a readable pathname
parse.GString

Parses a GString
intervalsToSeq.matrix

Generates a vector of indices from a matrix of intervals
setOption.Options

Sets an option
isAbsolutePath

Checks if this pathname is absolute
parseDebian.System

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

Gets the unprocessed GString
readBinFragments

Reads binary data from disjoint sections of a connection or a file
getBuiltinDate.GString

Gets the current date
asShort.Java

Converts a numeric to a Java short
listDirectory

Gets the file names in the directory
extract.array

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

Capitalizes/decapitalizes each character string in a vector
lastModified

Gets the time when the file was last modified
readInt.Java

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

Creates a file atomically
getIndices.Arguments

Coerces to a integer vector and validates
equals.Options

Checks if this object is equal to another Options object
env

Creates a new environment, evaluates an expression therein, and returns the environment
parse.SmartComments

Parses one single smart comment
getBuiltinUsername.GString

Gets the username of the user running R
finalizeSession

Function to call for finalizing the R session
toCamelCase

Converts a string of words into a merged camel-cased word
getCharacters.Arguments

Coerces to a character vector and validates
setTicks.ProgressBar

Sets values for which ticks should be visible
devEval

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

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

Static method asserting thatan object is a single value
readRdHelp

Reads one or more Rd help files in a certain format
isVisible.Verbose

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

Prints the processed GString
isVector.Assert

Static method asserting thatan object is a vector
pushState.Verbose

Pushes the current indentation state of the Verbose object
getBuiltinDatetime.GString

Gets the current date and time
unwrap.array

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

Converts vector indices to array indices
touchFile

Updates the timestamp of a file
isEof.connection

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

Retrieves the name of the user running R
isZero

Checks if a value is (close to) zero or not
reset.VComments

Resets a VComments compiler
pushTemporaryFile

Appends a temporary suffix to the pathname
printf

C-style formatted output
getTimestampFormat.Verbose

Gets the default timestamp format
onSessionExit

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

Reads a file in table format
sourceTo

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

Prints the structure of an object if above threshold
renameFile

Renames a file safely
setDefaultLevel.Verbose

Sets the current default verbose level
setMaxValue.ProgressBar

Sets maximum value
popTemporaryFile

Drops a temporary suffix from the temporary pathname
reset.ProgressBar

Reset progress bar
writeShort.Java

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

Checks if a set of values are inside one or more intervals
lapply.MultiVerbose

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

Gets a writable pathname
subplots

Creates a grid of subplots
png2

A PNG device for Bitmap Files via GhostScript
pushBackupFile

Appends a backup suffix to the pathname
popBackupFile

Drops a backup suffix from the backup pathname
wrap.array

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

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

Writes objects if above threshold
ruler.Verbose

Writes a ruler
writeUTF.Java

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

Maps values to intervals
writeByte.Java

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

Creates a cloned instance with a lower threshold
writeInt.Java

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

Gets the label of a device
readWindowsShortcut

Reads a Microsoft Windows Shortcut (.lnk file)
filePath

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

Validates a vector
getMessage.TimeoutException

Gets the message of the exception
gzip

Gzip/Gunzip a file
setValue.ProgressBar

Sets current value
toUrl

Converts a pathname into a URL
summary.Verbose

Generates a summary of an object if above threshold
validate.SmartComments

Validates the compiled lines
validate.VComments

Validates the compiled lines
Verbose

Class to writing verbose messages to a connection or file
insert

Insert values to a vector at certain positions
setLabels.TextStatusBar

Sets new values of given labels
openBrowser.System

Opens an HTML document using the OS default HTML browser
popMessage.TextStatusBar

Adds a message above the status bar
writeRaw.MultiVerbose

Writes to each of the Verbose objects
relibrary

Reloads a package
seqToHumanReadable

Gets a short human readable string representation of an vector of indices
newline.TextStatusBar

Writes a newline
as.character.ProgressBar

Gets a string description of the progress bar
bunzip2

Bunzip a file
findSettings.Settings

Searches for the settings file in one or several directories
devNew

Opens a new device
getRegularExpression.Arguments

Gets a valid regular expression pattern
patchCode

Patches installed and loaded packages and more
saveObject

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

Sets default step length
as.character.binmode

Converts a binary/octal/hexadecimal number into a string
getBarString.ProgressBar

Gets the progress bar string to be displayed
getEnvironment.Arguments

Gets an existing environment
getOption.Options

Gets an option
getLabel.TextStatusBar

Gets the current value of a label
hasUrlProtocol

Checks if one or several pathnames has a URL protocol
inherits.Assert

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

Checks if progress bar is completed
moveInSearchPath

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

Static method asserting thatan object is a matrix
mergeIntervals.numeric

Merges intervals
resample

Sample values from a set of elements
sourceDirectory

Sources files recursively to either local or global environment
timestampOn.Verbose

Turns automatic timestamping on and off
update.FileProgressBar

Updates file progress bar
R.utils-package

Package R.utils
asLong.Java

Converts a numeric to a Java long
evaluate.Verbose

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

Gets the operating system of the running machine
getVariableValue.GString

Gets a variable value given a name and attributes
isVisible.NullVerbose

Checks if a certain verbose level will be shown or not
newline.Verbose

Writes one or several empty lines
readShort.Java

Reads a Java formatted short (16 bits) from a connection
reset.SmartComments

Resets a SmartComments compiler
removeDirectory

Removes a directory
flush.TextStatusBar

Flushes the output