Learn R Programming

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

R.utils (version 0.5.5)

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

163,892

Version

0.5.5

License

LGPL version 2.1 or newer (the releases)

Maintainer

Henrik Bengtsson

Last Published

February 24th, 2025

Functions in R.utils (0.5.5)

Assert

The Assert class
Java

Static class for Java related methods
doCall

Executes a function call with option to ignore unused arguments
check.Assert

Static method asserting that a generic condition is true
isScalar.Assert

Static method asserting thatan object is a single value
getBuiltinRhome.GString

Gets the path where R is installed
commandArgs

Extract Command Line Arguments
exit.Verbose

Writes a message and unindents the following output
evaluate.Verbose

Evaluates a function and prints its results if above threshold
getHostname.System

Retrieves the computer name of the current host
addFinalizerToLast

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

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

The LComments class
equals.Verbose

Checks if this object is equal to another
getParent

Gets the string of the parent specified by this pathname
finalizeSession

Function to call for finalizing the R session
as.logical.Verbose

Gets a logical value of this object
as.character.Verbose

Returns a character string version of this object
as.character.ProgressBar

Gets a string description of the progress bar
Non-documented objects

Non-documented objects
Arguments

Static class to validate and process arguments
setTicks.ProgressBar

Sets values for which ticks should be visible
asLong.Java

Converts a numeric to a Java long
getBuiltinDate.GString

Gets the current date
getVerbose.Arguments

Coerces to Verbose object
asShort.Java

Converts a numeric to a Java short
cat.Verbose

Concatenates and prints objects if above threshold
Settings

Class for applicational settings
convertComment.SmartComments

Converts a single smart comment to R code
FileProgressBar

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

Splits a single character string by pattern
getDoubles.Arguments

Coerces to a double vector and validates
loadAnywhere.Settings

Loads settings from file
getLeaves.Options

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

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

Coerces to a integer vector and validates
. About this package

About this package
gunzip

Gunzip a file
patchCode

Patches installed and loaded packages and more
hasOption.Options

Checks if an option exists
writeRaw.Verbose

Writes objects if above threshold
findGhostscript.System

Searches for the ghostview binary on the current system
getVector.Arguments

Validates a vector
summary.Verbose

Generates a summary of an object if above threshold
getBuiltinRversion.GString

Gets the current R version
saveAnywhere.Settings

Saves settings to file
promptAndSave.Settings

Prompt user to save modified settings
SmartComments

Abstract class SmartComments
as.character.binmode

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

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

Character string with advanced substitutions
callHooks

Call hook functions
as.character.GString

Gets the processed character string
inherits.Assert

Static method asserting that an object inherits from of a certain class
writeByte.Java

Writes a byte (8 bits) to a connection in Java format
getLogicals.Arguments

Coerces to a logical vector and validates
isVisible.Verbose

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

Gets a variable value given a name and attributes
getBarString.ProgressBar

Gets the progress bar string to be displayed
isOn.NullVerbose

Checks if the output is on
getBuiltinUsername.GString

Gets the username of the user running R
getBuiltinTime.GString

Gets the current time
print.Verbose

Prints objects if above threshold
capitalize

Capitalizes/decapitalizes each character string in a vector
currentTimeMillis.System

Get the current time in milliseconds
str.Verbose

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

Sets maximum value
str.Options

Prints the structure of the options
update.FileProgressBar

Updates file progress bar
seqToHumanReadable

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

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

Checks if the file specification is a directory
getCharacters.Arguments

Coerces to a character vector and validates
print.GString

Prints the processed GString
ruler.Verbose

Writes a ruler
readWindowsShortcut

Reads a Microsoft Windows Shortcut (.lnk file)
isModified.Settings

Checks if settings has been modified compared to whats on file
writeUTF.Java

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

Resets a VComments compiler
writeInt.Java

Writes a integer (32 bits) to a connection in Java format
getNumerics.Arguments

Coerces to a numeric vector and validates
sourceDirectory

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

Turn off the output
isVisible.NullVerbose

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

Writes a timestamp
increase.ProgressBar

Increases (steps) progress bar
listDirectory

Gets the file names in the directory
setOption.Options

Sets an option
isZero

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

Resets a SmartComments compiler
VComments

The VComments class
writeRaw.NullVerbose

All output methods
lastModified

Gets the time when the file was last modified
parse.SmartComments

Parses one single smart comment
on.Verbose

Turn on the output
getBuiltinHostname.GString

Gets the hostname of the system running R
getBuiltinDatetime.GString

Gets the current date and time
readInt.Java

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

Converts a numeric to a Java byte
getReadablePathname.Arguments

Gets a readable pathname
Verbose

Class to writing verbose messages to a connection or file
getIntegers.Arguments

Coerces to a integer vector and validates
asInt.Java

Converts an numeric to a Java integer
convertComment.VComments

Converts a verbose comment to R code
NullVerbose

A Verbose class ignoring everything
compile.SmartComments

Preprocess a vector of code lines
insert

Insert values to a vector at certain positions
getAbsolutePath

Gets the absolute pathname string
findSettings.Settings

Searches for the settings file in one or several directories
readUTF.Java

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

Sets default step length
isFile

Checks if the file specification is a file
nbrOfOptions.Options

Gets the number of options set
isVector.Assert

Static method asserting thatan object is a vector
reset.ProgressBar

Reset progress bar
newline.Verbose

Writes one or several empty lines
parse.GString

Parses a GString
resetWarnings

Resets recorded warnings
printf.Verbose

Formats and prints object if above threshold
relibrary

Reloads a package
readByte.Java

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

Sets verbose threshold
update.ProgressBar

Updates progress bar
readShort.Java

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

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

Static class to query information about the system
Options

The Options class
capture.Verbose

Captures output of a function
detachPackage

Detaches a packages by name
as.list.Options

Gets a list representation of the options
enter.Verbose

Writes a message and indents the following output
getBuiltinPid.GString

Gets the process id of the current R session
as.character.Options

Returns a character string version of this object
ProgressBar

Provides text based counting progress bar
getRelativePath

Gets the relative pathname relative to a directory
getBuiltinOs.GString

Gets the operating system of the running machine
attachLocally.list

Assigns an objects elements locally
mkdirs

Creates a directory including any necessary but nonexistent parent directories
getLoadedPathname.Settings

Gets the pathname of the settings file loaded
getOption.Options

Gets an option
getThreshold.Verbose

Gets current verbose threshold
validate.VComments

Validates the compiled lines
getRaw.GString

Gets the unprocessed GString
openBrowser.System

Opens an HTML document using the OS default HTML browser
toUrl

Converts a pathname into a URL
header.Verbose

Writes a header
getUsername.System

Retrieves the name of the user running R
isOn.Verbose

Checks if the output is on
setDefaultLevel.Verbose

Sets the current default verbose level
pushState.Verbose

Pushes the current indentation state of the Verbose object
names.Options

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

Parses and evaluates code from a file or a connection
setProgress.ProgressBar

Sets current progress
writeShort.Java

Writes a short (16 bits) to a connection in Java format
isMatrix.Assert

Static method asserting thatan object is a matrix
setValue.ProgressBar

Sets current value
getWritablePathname.Arguments

Gets a writable pathname
isAbsolutePath

Checks if this pathname is absolute
validate.SmartComments

Validates the compiled lines
warnings.Verbose

Outputs any warnings recorded
isDone.ProgressBar

Checks if progress bar is completed
parseDebian.System

Parses a string, file or connection for Debian formatted parameters