Learn R Programming

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

R.utils (version 0.7.9)

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

License

LGPL version 2.1 or newer (the releases)

Maintainer

Henrik Bengtsson

Last Published

February 24th, 2025

Functions in R.utils (0.7.9)

displayCode

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

Abstract class SmartComments
as.logical.Verbose

Gets a logical value of this object
isScalar.Assert

Static method asserting thatan object is a single value
Verbose

Class to writing verbose messages to a connection or file
as.list.Options

Gets a list representation of the options
getRelativePath

Gets the relative pathname relative to a directory
mkdirs

Creates a directory including any necessary but nonexistent parent directories
seqToHumanReadable

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

Converts a numeric to a Java short
getLoadedPathname.Settings

Gets the pathname of the settings file loaded
GString

Character string with advanced substitutions
attachLocally.list

Assigns an objects elements locally
Settings

Class for applicational settings
as.character.GString

Gets the processed character string
extract.array

Extract a subset of an array, matrix or a vector with unknown dimensions
asByte.Java

Converts a numeric to a Java byte
insert

Insert values to a vector at certain positions
getBuiltinHostname.GString

Gets the hostname of the system running R
eps

EPS graphics device
readTableIndex

Reads a single column from file in table format
jpeg2

A JPEG device for Bitmap Files via GhostScript
setTicks.ProgressBar

Sets values for which ticks should be visible
getAbsolutePath

Gets the absolute pathname string
openBrowser.System

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

Searches for a working PNG device
getBuiltinDatetime.GString

Gets the current date and time
getBuiltinRhome.GString

Gets the path where R is installed
getLogicals.Arguments

Coerces to a logical vector and validates
increase.ProgressBar

Increases (steps) progress bar
timestamp.Verbose

Writes a timestamp
isModified.Settings

Checks if settings has been modified compared to whats on file
isDone.ProgressBar

Checks if progress bar is completed
Arguments

Static class to validate and process arguments
as.character.ProgressBar

Gets a string description of the progress bar
isUrl

Checks if one or several pathnames is URLs
saveAnywhere.Settings

Saves settings to file
isZero

Checks if a value is (close to) zero or not
names.Options

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

Sets the default timestamp format
equals.Options

Checks if this object is equal to another Options object
filePath

Construct the path to a file from components and expands Windows Shortcuts along the pathname from root to leaf
as.double.Verbose

Gets a numeric value of this object
writeInt.Java

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

Detaches a packages by name
as.character.binmode

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

A Verbose class ignoring everything
VComments

The VComments class
getVector.Arguments

Validates a vector
enter.Verbose

Writes a message and indents the following output
sourceDirectory

Sources files recursively to either local or global environment
Non-documented objects

Non-documented objects
getBarString.ProgressBar

Gets the progress bar string to be displayed
str.Options

Prints the structure of the options
evaluate.Verbose

Evaluates a function and prints its results if above threshold
ProgressBar

Provides text based counting progress bar
hasOption.Options

Checks if an option exists
callHooks.function

Call hook functions
png2

A PNG device for Bitmap Files via GhostScript
findSettings.Settings

Searches for the settings file in one or several directories
summary.Verbose

Generates a summary of an object if above threshold
as.character.Options

Returns a character string version of this object
callHooks

Call hook functions by hook name
setLabel.TextStatusBar

Sets the value of a label
nbrOfOptions.Options

Gets the number of options set
getBuiltinOs.GString

Gets the operating system of the running machine
check.Assert

Static method asserting that a generic condition is true
getBuiltinUsername.GString

Gets the username of the user running R
getBuiltinDate.GString

Gets the current date
onSessionExit

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

Capitalizes/decapitalizes each character string in a vector
getIntegers.Arguments

Coerces to a integer vector and validates
parseDebian.System

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

Gets the current R version
getThreshold.Verbose

Gets current verbose threshold
readByte.Java

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

Gets an existing environment
asLong.Java

Converts a numeric to a Java long
copyDirectory

Copies a directory
compile.SmartComments

Preprocess a vector of code lines
getParent

Gets the string of the parent specified by this pathname
getReadablePathnames.Arguments

Gets a readable pathname
addFinalizerToLast

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

Gets the default timestamp format
isAbsolutePath

Checks if this pathname is absolute
update.ProgressBar

Updates progress bar
isVector.Assert

Static method asserting thatan object is a vector
str.Verbose

Prints the structure of an object if above threshold
doCall

Executes a function call with option to ignore unused arguments
getOption.Options

Gets an option
setStepLength.ProgressBar

Sets default step length
convertComment.SmartComments

Converts a single smart comment to R code
isVisible.NullVerbose

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

Parses a GString
equals.Verbose

Checks if this object is equal to another
isDirectory

Checks if the file specification is a directory
isFile

Checks if the file specification is a file
parse.SmartComments

Parses one single smart comment
newline.TextStatusBar

Writes a newline
readShort.Java

Reads a Java formatted short (16 bits) from a connection
loadAnywhere.Settings

Loads settings from file
getDoubles.Arguments

Coerces to a double vector and validates
getReadablePathname.Arguments

Gets a readable pathname
listDirectory

Gets the file names in the directory
readInt.Java

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

Checks if the output is on
getBuiltinTime.GString

Gets the current time
on.Verbose

Turn on the output
sourceTo

Parses and evaluates code from a file or a connection
getRegularExpression.Arguments

Gets a valid regular expression pattern
getBuiltinPid.GString

Gets the process id of the current R session
setLabels.TextStatusBar

Sets new values of given labels
setProgress.ProgressBar

Sets current progress
isMatrix.Assert

Static method asserting thatan object is a matrix
timestampOn.Verbose

Turns automatic timestamping on and off
resetWarnings

Resets recorded warnings
newline.Verbose

Writes one or several empty lines
setMaxValue.ProgressBar

Sets maximum value
printf.Verbose

Formats and prints object if above threshold
remove.FileProgressBar

Removes the progress file for a file progress bar
toUrl

Converts a pathname into a URL
hasUrlProtocol

Checks if one or several pathnames has a URL protocol
writeRaw.Verbose

Writes objects if above threshold
getUsername.System

Retrieves the name of the user running R
currentTimeMillis.System

Get the current time in milliseconds
writeByte.Java

Writes a byte (8 bits) to a connection in Java format
writeRaw.NullVerbose

All output methods
getCharacters.Arguments

Coerces to a character vector and validates
Assert

The Assert class
asInt.Java

Converts an numeric to a Java integer
promptAndSave.Settings

Prompt user to save modified settings
reset.SmartComments

Resets a SmartComments compiler
capture.Verbose

Captures output of a function
FileProgressBar

A progress bar that sets the size of a file accordingly
cat.Verbose

Concatenates and prints objects if above threshold
writeUTF.Java

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

Static class to query information about the system
setDefaultLevel.Verbose

Sets the current default verbose level
validate.VComments

Validates the compiled lines
getNumerics.Arguments

Coerces to a numeric vector and validates
commandArgs

Extract Command Line Arguments
warnings.Verbose

Outputs any warnings recorded
setThreshold.Verbose

Sets verbose threshold
getVerbose.Arguments

Coerces to Verbose object
getRaw.GString

Gets the unprocessed GString
patchCode

Patches installed and loaded packages and more
as.character.Verbose

Returns a character string version of this object
getIndices.Arguments

Coerces to a integer vector and validates
seqToIntervals

Gets all contigous intervals of a vector of indices
wrap.array

Reshape an array or a matrix by permuting and/or joining dimensions
header.Verbose

Writes a header
off.Verbose

Turn off the output
getWritablePathname.Arguments

Gets a writable pathname
print.Verbose

Prints objects if above threshold
pushState.Verbose

Pushes the current indentation state of the Verbose object
relibrary

Reloads a package
splitByPattern

Splits a single character string by pattern
reset.ProgressBar

Reset progress bar
update.FileProgressBar

Updates file progress bar
validate.SmartComments

Validates the compiled lines
update.TextStatusBar

Updates the status bar (visually)
print.GString

Prints the processed GString
readUTF.Java

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

Gunzip a file
LComments

The LComments class
exit.Verbose

Writes a message and unindents the following output
finalizeSession

Function to call for finalizing the R session
getHostname.System

Retrieves the computer name of the current host
getLabel.TextStatusBar

Gets the current value of a label
getVariableValue.GString

Gets a variable value given a name and attributes
inherits.Assert

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

Sets current value
Options

The Options class
findGhostscript.System

Searches for the ghostview binary on the current system
intToBin

Converts an integer to a binary/octal/hexadecimal number
isOn.NullVerbose

Checks if the output is on
updateLabels.TextStatusBar

Sets the new values of given labels and updates the status bar
convertComment.VComments

Converts a verbose comment to R code
readWindowsShortcut

Reads a Microsoft Windows Shortcut (.lnk file)
Java

Static class for Java related methods
ruler.Verbose

Writes a ruler
writeShort.Java

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

Reads a file in table format
TextStatusBar

A status bar at the R prompt that can be updated
getLeaves.Options

Gets all (non-list) options in a flat list
lastModified

Gets the time when the file was last modified
setOption.Options

Sets an option
reset.VComments

Resets a VComments compiler
isVisible.Verbose

Checks if a certain verbose level will be shown or not
unwrap.array

Unwrap an array, matrix or a vector to an array of more dimensions
R.utils-package

Package R.utils