Learn R Programming

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

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

163,892

Version

1.1.1

License

LGPL (>= 2.1)

Maintainer

Henrik Bengtsson

Last Published

February 24th, 2025

Functions in R.utils (1.1.1)

LComments

The LComments class
capitalize

Capitalizes/decapitalizes each character string in a vector
VComments

The VComments class
as.character.ProgressBar

Gets a string description of the progress bar
asByte.Java

Converts a numeric to a Java byte
Options

The Options class
check.Assert

Static method asserting that a generic condition is true
cat.Verbose

Concatenates and prints objects if above threshold
asShort.Java

Converts a numeric to a Java short
eps

EPS graphics device
getLeaves.Options

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

Get the current time in milliseconds
devGetLabel

Gets the label of a device
getHostname.System

Retrieves the computer name of the current host
isOn.Verbose

Checks if the output is on
compile.SmartComments

Preprocess a vector of code lines
listDirectory

Gets the file names in the directory
NullVerbose

A Verbose class ignoring everything
print.GString

Prints the processed GString
getRegularExpression.Arguments

Gets a valid regular expression pattern
as.character.Options

Returns a character string version of this object
isScalar.Assert

Static method asserting thatan object is a single value
Settings

Class for applicational settings
names.Options

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

The Assert class
convertComment.VComments

Converts a verbose comment to R code
callHooks.function

Call hook functions
System

Static class to query information about the system
getVariableValue.GString

Gets a variable value given a name and attributes
getIndices.Arguments

Coerces to a integer vector and validates
findGhostscript.System

Searches for the ghostview binary on the current system
findGraphicsDevice.System

Searches for a working PNG device
SmartComments

Abstract class SmartComments
fileAccess

Checks the permission of a file
getThreshold.Verbose

Gets current verbose threshold
isMatrix.Assert

Static method asserting thatan object is a matrix
lapply.MultiVerbose

Applies a function to each of the Verbose objects
ProgressBar

Provides text based counting progress bar
FileProgressBar

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

Executes a function call with option to ignore unused arguments
finalizeSession

Function to call for finalizing the R session
setTicks.ProgressBar

Sets values for which ticks should be visible
inherits.Assert

Static method asserting that an object inherits from of a certain class
getBuiltinRversion.GString

Gets the current R version
as.list.Options

Gets a list representation of the options
devNew

Opens a new device
getRelativePath

Gets the relative pathname relative to a directory
mergeIntervals.numeric

Merges intervals
asInt.Java

Converts an numeric to a Java integer
detachPackage

Detaches a packages by name
Non-documented objects

Non-documented objects
equals.Verbose

Checks if this object is equal to another
devDone

Closes an on-screen (interactive) device
print.Verbose

Prints objects if above threshold
arrayIndex

Converts vector indices to array indices
as.character.GString

Gets the processed character string
MultiVerbose

A Verbose class ignoring everything
setOption.Options

Sets an option
getRaw.GString

Gets the unprocessed GString
hasUrlProtocol

Checks if one or several pathnames has a URL protocol
getIntegers.Arguments

Coerces to a integer vector and validates
asLong.Java

Converts a numeric to a Java long
splitByPattern

Splits a single character string by pattern
Java

Static class for Java related methods
isOpen.character

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

Checks if the current file position for a connection is at the 'End of File'
Arguments

Static class to validate and process arguments
convertComment.SmartComments

Converts a single smart comment to R code
getBuiltinUsername.GString

Gets the username of the user running R
colClasses

Creates a vector of column classes used for tabular reading
update.FileProgressBar

Updates file progress bar
commandArgs

Extract Command Line Arguments
filePath

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

Converts a pathname into a URL
intToBin

Converts an integer to a binary/octal/hexadecimal number
equals.Options

Checks if this object is equal to another Options object
remove.FileProgressBar

Removes the progress file for a file progress bar
getBuiltinDatetime.GString

Gets the current date and time
extract.array

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

Checks if this pathname is absolute
seqToHumanReadable

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

Allocates a data frame with given column classes
str.Options

Prints the structure of the options
isVector.Assert

Static method asserting thatan object is a vector
isPackageLoaded

Checks if a package is loaded or not
openBrowser.System

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

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

Checks if one or several pathnames is URLs
resetWarnings

Resets recorded warnings
devList

Lists the indices of the open devices named by their labels
getVector.Arguments

Validates a vector
getLogicals.Arguments

Coerces to a logical vector and validates
isVisible.NullVerbose

Checks if a certain verbose level will be shown or not
R.utils-package

Package R.utils
copyDirectory

Copies a directory
devSetLabel

Sets the label of a device
writeShort.Java

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

Closes a device
readBinFragments

Reads binary data from disjoint sections of a connection or a file
reassignInPackage

Re-assigns a new value to an existing object in a loaded package
as.double.Verbose

Gets a numeric value of this object
popMessage.TextStatusBar

Adds a message above the status bar
getBuiltinHostname.GString

Gets the hostname of the system running R
str.Verbose

Prints the structure of an object if above threshold
getVerbose.Arguments

Coerces to Verbose object
lastModified

Gets the time when the file was last modified
bunzip2

Bunzip a file
setStepLength.ProgressBar

Sets default step length
exit.Verbose

Writes a message and unindents the following output
on.Verbose

Turn on the output
getBarString.ProgressBar

Gets the progress bar string to be displayed
summary.Verbose

Generates a summary of an object if above threshold
evaluate.Verbose

Evaluates a function and prints its results if above threshold
devIsOpen

Checks if a device is open or not
getBuiltinDate.GString

Gets the current date
enter.Verbose

Writes a message and indents the following output
moveInSearchPath

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

Gets the current time
jpeg2

A JPEG device for Bitmap Files via GhostScript
setLabel.TextStatusBar

Sets the value of a label
as.logical.Verbose

Gets a logical value of this object
gzip

Gzip/Gunzip a file
setTimestampFormat.Verbose

Sets the default timestamp format
mkdirs

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

Creates a cloned instance with a higher threshold
findSettings.Settings

Searches for the settings file in one or several directories
getLabel.TextStatusBar

Gets the current value of a label
as.character.binmode

Converts a binary/octal/hexadecimal number into a string
getBuiltinRhome.GString

Gets the path where R is installed
setLabels.TextStatusBar

Sets new values of given labels
setValue.ProgressBar

Sets current value
attachLocally.list

Assigns an objects elements locally
getUsername.System

Retrieves the name of the user running R
getBuiltinOs.GString

Gets the operating system of the running machine
updateLabels.TextStatusBar

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

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

Coerces to a numeric vector and validates
loadAnywhere.Settings

Loads settings from file
devSet

Activates a device
reset.ProgressBar

Reset progress bar
saveAnywhere.Settings

Saves settings to file
isModified.Settings

Checks if settings has been modified compared to whats on file
getEnvironment.Arguments

Gets an existing environment
update.TextStatusBar

Updates the status bar (visually)
readTableIndex

Reads a single column from file in table format
printf.Verbose

Formats and prints object if above threshold
mapToIntervals.numeric

Maps values to intervals
parse.GString

Parses a GString
pushState.Verbose

Pushes the current indentation state of the Verbose object
inAnyInterval.numeric

Checks if a set of values are inside one or more intervals
displayCode

Displays the contents of a text file with line numbers and more
newline.Verbose

Writes one or several empty lines
writeBinFragments

Writes binary data to disjoint sections of a connection or a file
wrap.array

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

Resets a SmartComments compiler
header.Verbose

Writes a header
writeByte.Java

Writes a byte (8 bits) to a connection in Java format
getLoadedPathname.Settings

Gets the pathname of the settings file loaded
Verbose

Class to writing verbose messages to a connection or file
writeRaw.Verbose

Writes objects if above threshold
getBuiltinPid.GString

Gets the process id of the current R session
getParent

Gets the string of the parent specified by this pathname
insert

Insert values to a vector at certain positions
isDirectory

Checks if the file specification is a directory
hasOption.Options

Checks if an option exists
promptAndSave.Settings

Prompt user to save modified settings
reset.VComments

Resets a VComments compiler
getCharacters.Arguments

Coerces to a character vector and validates
countLines

Counts the number of lines in a text file
isZero

Checks if a value is (close to) zero or not
increase.ProgressBar

Increases (steps) progress bar
as.character.Verbose

Returns a character string version of this object
getTimestampFormat.Verbose

Gets the default timestamp format
validate.VComments

Validates the compiled lines
relibrary

Reloads a package
readByte.Java

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

Gets all contigous intervals of a vector of indices
getDoubles.Arguments

Coerces to a double vector and validates
intervalsToSeq.matrix

Generates a vector of indices from a matrix of intervals
getReadablePathnames.Arguments

Gets a readable pathname
off.Verbose

Turn off the output
timestamp.Verbose

Writes a timestamp
onSessionExit

Registers a function to be called when the R session finishes
readShort.Java

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

Modifies .Last() to call 'finalizeSession()
Sys.setenv

Sys.setenv
validate.SmartComments

Validates the compiled lines
TextStatusBar

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

Gets the number of options set
loadToEnv

Method to load objects to a new environment
loadObject

Method to load object from a file or a connection
saveObject

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

Writes a newline
getOption.Options

Gets an option
setDefaultLevel.Verbose

Sets the current default verbose level
writeInt.Java

Writes a integer (32 bits) to a connection in Java format
update.ProgressBar

Updates progress bar
setThreshold.Verbose

Sets verbose threshold
toCamelCase

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

Gets a writable pathname
isFile

Checks if the file specification is a file
whichVector.logical

Identifies TRUE elements in a logical vector
readUTF.Java

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

Checks if progress bar is completed
unwrap.array

Unwrap an array, matrix or a vector to an array of more dimensions
isVisible.Verbose

Checks if a certain verbose level will be shown or not
setProgress.ProgressBar

Sets current progress
ruler.Verbose

Writes a ruler
flush.TextStatusBar

Flushes the output
sourceDirectory

Sources files recursively to either local or global environment
writeRaw.NullVerbose

All output methods
more.Verbose

Creates a cloned instance with a lower threshold
readInt.Java

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

Call hook functions by hook name
touchFile

Updates the timestamp of a file
writeUTF.Java

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

Reads a file in table format
readWindowsShortcut

Reads a Microsoft Windows Shortcut (.lnk file)
patchCode

Patches installed and loaded packages and more
warnings.Verbose

Outputs any warnings recorded
GString

Character string with advanced substitutions
capture.Verbose

Captures output of a function
copyFile

Copies a file safely
getAbsolutePath

Gets the absolute pathname string
getReadablePathname.Arguments

Gets a readable pathname
isOn.NullVerbose

Checks if the output is on
png2

A PNG device for Bitmap Files via GhostScript
parse.SmartComments

Parses one single smart comment
timestampOn.Verbose

Turns automatic timestamping on and off
setMaxValue.ProgressBar

Sets maximum value
writeRaw.MultiVerbose

Writes to each of the Verbose objects