Learn R Programming

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

R.utils (version 0.9.1)

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

License

LGPL version 2.1 or newer (the releases)

Maintainer

Henrik Bengtsson

Last Published

February 24th, 2025

Functions in R.utils (0.9.1)

ProgressBar

Provides text based counting progress bar
getParent

Gets the string of the parent specified by this pathname
callHooks.function

Call hook functions
getLoadedPathname.Settings

Gets the pathname of the settings file loaded
Settings

Class for applicational settings
finalizeSession

Function to call for finalizing the R session
evaluate.Verbose

Evaluates a function and prints its results if above threshold
Java

Static class for Java related methods
header.Verbose

Writes a header
isMatrix.Assert

Static method asserting thatan object is a matrix
getLeaves.Options

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

Gets the progress bar string to be displayed
SmartComments

Abstract class SmartComments
getVector.Arguments

Validates a vector
on.Verbose

Turn on the output
Verbose

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

Searches for the ghostview binary on the current system
NullVerbose

A Verbose class ignoring everything
cat.Verbose

Concatenates and prints objects if above threshold
LComments

The LComments class
equals.Options

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

Converts a single smart comment to R code
getBuiltinDate.GString

Gets the current date
check.Assert

Static method asserting that a generic condition is true
currentTimeMillis.System

Get the current time in milliseconds
as.list.Options

Gets a list representation of the options
Non-documented objects

Non-documented objects
enter.Verbose

Writes a message and indents the following output
as.character.Options

Returns a character string version of this object
TextStatusBar

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

Call hook functions by hook name
extract.array

Extract a subset of an array, matrix or a vector with unknown dimensions
getOption.Options

Gets an option
getBuiltinTime.GString

Gets the current time
System

Static class to query information about the system
getRegularExpression.Arguments

Gets a valid regular expression pattern
isOpen.character

Checks if there is an open connection in Rto a file
exit.Verbose

Writes a message and unindents the following output
insert

Insert values to a vector at certain positions
getVerbose.Arguments

Coerces to Verbose object
getWritablePathname.Arguments

Gets a writable pathname
doCall

Executes a function call with option to ignore unused arguments
as.logical.Verbose

Gets a logical value of this object
getLabel.TextStatusBar

Gets the current value of a label
as.double.Verbose

Gets a numeric value of this object
getCharacters.Arguments

Coerces to a character vector and validates
getBuiltinPid.GString

Gets the process id of the current R session
getIntegers.Arguments

Coerces to a integer vector and validates
detachPackage

Detaches a packages by name
displayCode

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

Reads a Microsoft Windows Shortcut (.lnk file)
as.character.GString

Gets the processed character string
Options

The Options class
readInt.Java

Reads a Java formatted int (32 bits) from a connection
getBuiltinRhome.GString

Gets the path where R is installed
getAbsolutePath

Gets the absolute pathname string
parse.SmartComments

Parses one single smart comment
capture.Verbose

Captures output of a function
seqToHumanReadable

Gets a short human readable string representation of an vector of indices
asByte.Java

Converts a numeric to a Java byte
copyDirectory

Copies a directory
getThreshold.Verbose

Gets current verbose threshold
attachLocally.list

Assigns an objects elements locally
compile.SmartComments

Preprocess a vector of code lines
isFile

Checks if the file specification is a file
hasUrlProtocol

Checks if one or several pathnames has a URL protocol
seqToIntervals

Gets all contigous intervals of a vector of indices
getBuiltinUsername.GString

Gets the username of the user running R
findGraphicsDevice.System

Searches for a working PNG device
splitByPattern

Splits a single character string by pattern
print.Verbose

Prints objects if above threshold
validate.VComments

Validates the compiled lines
jpeg2

A JPEG device for Bitmap Files via GhostScript
arrayIndex

Converts vector indices to array indices
filePath

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

Character string with advanced substitutions
openBrowser.System

Opens an HTML document using the OS default HTML browser
timestampOn.Verbose

Turns automatic timestamping on and off
readTable

Reads a file in table format
setOption.Options

Sets an option
less.Verbose

Creates a cloned instance with a higher threshold
reset.SmartComments

Resets a SmartComments compiler
isOn.Verbose

Checks if the output is on
validate.SmartComments

Validates the compiled lines
timestamp.Verbose

Writes a timestamp
getIndices.Arguments

Coerces to a integer vector and validates
isVisible.NullVerbose

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

Turn off the output
as.character.Verbose

Returns a character string version of this object
loadAnywhere.Settings

Loads settings from file
setMaxValue.ProgressBar

Sets maximum value
parseDebian.System

Parses a string, file or connection for Debian formatted parameters
setTicks.ProgressBar

Sets values for which ticks should be visible
getUsername.System

Retrieves the name of the user running R
sourceTo

Parses and evaluates code from a file or a connection
isOn.NullVerbose

Checks if the output is on
unwrap.array

Unwrap an array, matrix or a vector to an array of more dimensions
getEnvironment.Arguments

Gets an existing environment
saveObject

Saves an object to a file or a connection
update.TextStatusBar

Updates the status bar (visually)
Arguments

Static class to validate and process arguments
more.Verbose

Creates a cloned instance with a lower threshold
promptAndSave.Settings

Prompt user to save modified settings
nbrOfOptions.Options

Gets the number of options set
writeRaw.NullVerbose

All output methods
as.character.ProgressBar

Gets a string description of the progress bar
isVector.Assert

Static method asserting thatan object is a vector
setDefaultLevel.Verbose

Sets the current default verbose level
writeRaw.Verbose

Writes objects if above threshold
wrap.array

Reshape an array or a matrix by permuting and/or joining dimensions
setLabels.TextStatusBar

Sets new values of given labels
relibrary

Reloads a package
isModified.Settings

Checks if settings has been modified compared to whats on file
saveAnywhere.Settings

Saves settings to file
setTimestampFormat.Verbose

Sets the default timestamp format
pushState.Verbose

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

Sets default step length
setThreshold.Verbose

Sets verbose threshold
getTimestampFormat.Verbose

Gets the default timestamp format
listDirectory

Gets the file names in the directory
capitalize

Capitalizes/decapitalizes each character string in a vector
loadToEnv

Method to load objects to a new environment
VComments

The VComments class
readTableIndex

Reads a single column from file in table format
getVariableValue.GString

Gets a variable value given a name and attributes
convertComment.VComments

Converts a verbose comment to R code
increase.ProgressBar

Increases (steps) progress bar
writeUTF.Java

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

Writes a byte (8 bits) to a connection in Java format
isScalar.Assert

Static method asserting thatan object is a single value
toCamelCase

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

Registers a function to be called when the R session finishes
getDoubles.Arguments

Coerces to a double vector and validates
getNumerics.Arguments

Coerces to a numeric vector and validates
update.ProgressBar

Updates progress bar
readShort.Java

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

Outputs any warnings recorded
updateLabels.TextStatusBar

Sets the new values of given labels and updates the status bar
newline.TextStatusBar

Writes a newline
reset.ProgressBar

Reset progress bar
popMessage.TextStatusBar

Adds a message above the status bar
getBuiltinRversion.GString

Gets the current R version
toUrl

Converts a pathname into a URL
lastModified

Gets the time when the file was last modified
setValue.ProgressBar

Sets current value
png2

A PNG device for Bitmap Files via GhostScript
ruler.Verbose

Writes a ruler
names.Options

Gets the full pathname of all (non-list) options
readByte.Java

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

A progress bar that sets the size of a file accordingly
setProgress.ProgressBar

Sets current progress
R.utils-package

Package R.utils
getLogicals.Arguments

Coerces to a logical vector and validates
hasOption.Options

Checks if an option exists
Sys.setenv

Sys.setenv
update.FileProgressBar

Updates file progress bar
summary.Verbose

Generates a summary of an object if above threshold
asInt.Java

Converts an numeric to a Java integer
writeInt.Java

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

Extract Command Line Arguments
getBuiltinDatetime.GString

Gets the current date and time
sourceDirectory

Sources files recursively to either local or global environment
getReadablePathname.Arguments

Gets a readable pathname
intToBin

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

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

Parses a GString
isUrl

Checks if one or several pathnames is URLs
print.GString

Prints the processed GString
reset.VComments

Resets a VComments compiler
as.character.binmode

Converts a binary/octal/hexadecimal number into a string
asLong.Java

Converts a numeric to a Java long
getBuiltinHostname.GString

Gets the hostname of the system running R
getBuiltinOs.GString

Gets the operating system of the running machine
getReadablePathnames.Arguments

Gets a readable pathname
asShort.Java

Converts a numeric to a Java short
equals.Verbose

Checks if this object is equal to another
getRaw.GString

Gets the unprocessed GString
gunzip

Gunzip a file
getRelativePath

Gets the relative pathname relative to a directory
isAbsolutePath

Checks if this pathname is absolute
mkdirs

Creates a directory including any necessary but nonexistent parent directories
newline.Verbose

Writes one or several empty lines
inherits.Assert

Static method asserting that an object inherits from of a certain class
isDirectory

Checks if the file specification is a directory
loadObject

Method to load object from a file or a connection
isZero

Checks if a value is (close to) zero or not
readUTF.Java

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

Removes the progress file for a file progress bar
str.Options

Prints the structure of the options
Assert

The Assert class
addFinalizerToLast

Modifies .Last() to call 'finalizeSession()
findSettings.Settings

Searches for the settings file in one or several directories
eps

EPS graphics device
getHostname.System

Retrieves the computer name of the current host
isDone.ProgressBar

Checks if progress bar is completed
printf.Verbose

Formats and prints object if above threshold
resetWarnings

Resets recorded warnings
writeShort.Java

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

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

Checks if a certain verbose level will be shown or not
setLabel.TextStatusBar

Sets the value of a label
patchCode

Patches installed and loaded packages and more