Learn R Programming

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

R.utils (version 0.9.6)

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

171,037

Version

0.9.6

License

LGPL version 2.1 or newer (the releases)

Maintainer

Henrik Bengtsson

Last Published

February 24th, 2025

Functions in R.utils (0.9.6)

asInt.Java

Converts an numeric to a Java integer
VComments

The VComments class
Settings

Class for applicational settings
currentTimeMillis.System

Get the current time in milliseconds
getVerbose.Arguments

Coerces to Verbose object
ProgressBar

Provides text based counting progress bar
LComments

The LComments class
capture.Verbose

Captures output of a function
getBuiltinDate.GString

Gets the current date
getBuiltinHostname.GString

Gets the hostname of the system running R
Options

The Options class
getBarString.ProgressBar

Gets the progress bar string to be displayed
Arguments

Static class to validate and process arguments
getRelativePath

Gets the relative pathname relative to a directory
getLoadedPathname.Settings

Gets the pathname of the settings file loaded
flush.TextStatusBar

Flushes the output
commandArgs

Extract Command Line Arguments
doCall

Executes a function call with option to ignore unused arguments
addFinalizerToLast

Modifies .Last() to call 'finalizeSession()
timestamp.Verbose

Writes a timestamp
intToBin

Converts an integer to a binary/octal/hexadecimal number
as.character.GString

Gets the processed character string
update.ProgressBar

Updates progress bar
asByte.Java

Converts a numeric to a Java byte
print.GString

Prints the processed GString
copyDirectory

Copies a directory
getNumerics.Arguments

Coerces to a numeric vector and validates
getRegularExpression.Arguments

Gets a valid regular expression pattern
names.Options

Gets the full pathname of all (non-list) options
off.Verbose

Turn off the output
R.utils-package

Package R.utils
writeRaw.Verbose

Writes objects if above threshold
NullVerbose

A Verbose class ignoring everything
as.character.ProgressBar

Gets a string description of the progress bar
getRaw.GString

Gets the unprocessed GString
asShort.Java

Converts a numeric to a Java short
isZero

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

The Assert class
getAbsolutePath

Gets the absolute pathname string
evaluate.Verbose

Evaluates a function and prints its results if above threshold
isDirectory

Checks if the file specification is a directory
hasOption.Options

Checks if an option exists
loadToEnv

Method to load objects to a new environment
as.character.Options

Returns a character string version of this object
finalizeSession

Function to call for finalizing the R session
isVisible.NullVerbose

Checks if a certain verbose level will be shown or not
parse.SmartComments

Parses one single smart comment
getLogicals.Arguments

Coerces to a logical vector and validates
getHostname.System

Retrieves the computer name of the current host
enter.Verbose

Writes a message and indents the following output
asLong.Java

Converts a numeric to a Java long
getVariableValue.GString

Gets a variable value given a name and attributes
moveInSearchPath

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

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

Patches installed and loaded packages and more
readTable

Reads a file in table format
ruler.Verbose

Writes a ruler
isAbsolutePath

Checks if this pathname is absolute
callHooks

Call hook functions by hook name
wrap.array

Reshape an array or a matrix by permuting and/or joining dimensions
reset.VComments

Resets a VComments compiler
writeRaw.MultiVerbose

Writes to each of the Verbose objects
summary.Verbose

Generates a summary of an object if above threshold
setValue.ProgressBar

Sets current value
displayCode

Displays the contents of a text file with line numbers and more
findGraphicsDevice.System

Searches for a working PNG device
setDefaultLevel.Verbose

Sets the current default verbose level
getReadablePathname.Arguments

Gets a readable pathname
onSessionExit

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

Sets an option
promptAndSave.Settings

Prompt user to save modified settings
readByte.Java

Reads a Java formatted byte (8 bits) from a connection
png2

A PNG device for Bitmap Files via GhostScript
toUrl

Converts a pathname into a URL
lastModified

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

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

Creates a directory including any necessary but nonexistent parent directories
popMessage.TextStatusBar

Adds a message above the status bar
warnings.Verbose

Outputs any warnings recorded
getCharacters.Arguments

Coerces to a character vector and validates
getBuiltinUsername.GString

Gets the username of the user running R
readUTF.Java

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

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

Updates file progress bar
saveAnywhere.Settings

Saves settings to file
resetWarnings

Resets recorded warnings
Sys.setenv

Sys.setenv
reset.ProgressBar

Reset progress bar
unwrap.array

Unwrap an array, matrix or a vector to an array of more dimensions
setProgress.ProgressBar

Sets current progress
getParent

Gets the string of the parent specified by this pathname
Non-documented objects

Non-documented objects
getThreshold.Verbose

Gets current verbose threshold
getIndices.Arguments

Coerces to a integer vector and validates
inherits.Assert

Static method asserting that an object inherits from of a certain class
nbrOfOptions.Options

Gets the number of options set
isUrl

Checks if one or several pathnames is URLs
jpeg2

A JPEG device for Bitmap Files via GhostScript
SmartComments

Abstract class SmartComments
writeUTF.Java

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

Converts vector indices to array indices
eps

EPS graphics device
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
MultiVerbose

A Verbose class ignoring everything
isScalar.Assert

Static method asserting thatan object is a single value
getDoubles.Arguments

Coerces to a double vector and validates
callHooks.function

Call hook functions
pushState.Verbose

Pushes the current indentation state of the Verbose object
seqToIntervals

Gets all contigous intervals of a vector of indices
capitalize

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

Sets verbose threshold
as.double.Verbose

Gets a numeric value of this object
timestampOn.Verbose

Turns automatic timestamping on and off
setStepLength.ProgressBar

Sets default step length
Java

Static class for Java related methods
getLabel.TextStatusBar

Gets the current value of a label
readWindowsShortcut

Reads a Microsoft Windows Shortcut (.lnk file)
compile.SmartComments

Preprocess a vector of code lines
str.Options

Prints the structure of the options
getOption.Options

Gets an option
print.Verbose

Prints objects if above threshold
isModified.Settings

Checks if settings has been modified compared to whats on file
extract.array

Extract a subset of an array, matrix or a vector with unknown dimensions
writeRaw.NullVerbose

All output methods
sourceTo

Parses and evaluates code from a file or a connection
writeInt.Java

Writes a integer (32 bits) to a connection in Java format
getBuiltinRhome.GString

Gets the path where R is installed
updateLabels.TextStatusBar

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

Reads a single column from file in table format
toCamelCase

Converts a string of words into a merged camel-cased word
cat.Verbose

Concatenates and prints objects if above threshold
loadObject

Method to load object from a file or a connection
setTimestampFormat.Verbose

Sets the default timestamp format
on.Verbose

Turn on the output
setLabels.TextStatusBar

Sets new values of given labels
newline.TextStatusBar

Writes a newline
as.character.binmode

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

Converts a single smart comment to R code
equals.Verbose

Checks if this object is equal to another
getBuiltinRversion.GString

Gets the current R version
GString

Character string with advanced substitutions
Verbose

Class to writing verbose messages to a connection or file
as.logical.Verbose

Gets a logical value of this object
as.list.Options

Gets a list representation of the options
findGhostscript.System

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

Checks if this object is equal to another Options object
getEnvironment.Arguments

Gets an existing environment
getReadablePathnames.Arguments

Gets a readable pathname
as.character.Verbose

Returns a character string version of this object
update.TextStatusBar

Updates the status bar (visually)
seqToHumanReadable

Gets a short human readable string representation of an vector of indices
convertComment.VComments

Converts a verbose comment to R code
isOn.Verbose

Checks if the output is on
setLabel.TextStatusBar

Sets the value of a label
printf.Verbose

Formats and prints object if above threshold
writeShort.Java

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

Prints the structure of an object if above threshold
lapply.MultiVerbose

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

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

Creates a cloned instance with a higher threshold
getLeaves.Options

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

Assigns an objects elements locally
splitByPattern

Splits a single character string by pattern
getIntegers.Arguments

Coerces to a integer vector and validates
parseDebian.System

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

Checks if one or several pathnames has a URL protocol
sourceDirectory

Sources files recursively to either local or global environment
check.Assert

Static method asserting that a generic condition is true
detachPackage

Detaches a packages by name
isMatrix.Assert

Static method asserting thatan object is a matrix
findSettings.Settings

Searches for the settings file in one or several directories
isOn.NullVerbose

Checks if the output is on
getBuiltinDatetime.GString

Gets the current date and time
TextStatusBar

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

Gets a writable pathname
isVisible.Verbose

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

Gunzip a file
header.Verbose

Writes a header
more.Verbose

Creates a cloned instance with a lower threshold
getBuiltinTime.GString

Gets the current time
insert

Insert values to a vector at certain positions
isOpen.character

Checks if there is an open connection in Rto a file
isVector.Assert

Static method asserting thatan object is a vector
parse.GString

Parses a GString
getTimestampFormat.Verbose

Gets the default timestamp format
relibrary

Reloads a package
reset.SmartComments

Resets a SmartComments compiler
setMaxValue.ProgressBar

Sets maximum value
loadAnywhere.Settings

Loads settings from file
newline.Verbose

Writes one or several empty lines
listDirectory

Gets the file names in the directory
openBrowser.System

Opens an HTML document using the OS default HTML browser
isFile

Checks if the file specification is a file
saveObject

Saves an object to a file or a connection
readInt.Java

Reads a Java formatted int (32 bits) from a connection
validate.VComments

Validates the compiled lines
FileProgressBar

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

Static class to query information about the system
bunzip2

Bunzip a file
exit.Verbose

Writes a message and unindents the following output
getBuiltinOs.GString

Gets the operating system of the running machine
increase.ProgressBar

Increases (steps) progress bar
isDone.ProgressBar

Checks if progress bar is completed
setTicks.ProgressBar

Sets values for which ticks should be visible
validate.SmartComments

Validates the compiled lines
getUsername.System

Retrieves the name of the user running R