Learn R Programming

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

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

227,712

Version

1.0.1

License

LGPL (>= 2.1)

Maintainer

Henrik Bengtsson

Last Published

February 24th, 2025

Functions in R.utils (1.0.1)

asLong.Java

Converts a numeric to a Java long
hasOption.Options

Checks if an option exists
as.list.Options

Gets a list representation of the options
copyDirectory

Copies a directory
equals.Options

Checks if this object is equal to another Options object
bunzip2

Bunzip a file
findSettings.Settings

Searches for the settings file in one or several directories
isModified.Settings

Checks if settings has been modified compared to whats on file
setOption.Options

Sets an option
TextStatusBar

A status bar at the R prompt that can be updated
getHostname.System

Retrieves the computer name of the current host
as.logical.Verbose

Gets a logical value of this object
getWritablePathname.Arguments

Gets a writable pathname
Sys.setenv

Sys.setenv
setMaxValue.ProgressBar

Sets maximum value
getOption.Options

Gets an option
header.Verbose

Writes a header
moveInSearchPath

Moves a environment in the search path to another position
as.character.Verbose

Returns a character string version of this object
colClasses

Creates a vector of column classes used for tabular reading
detachPackage

Detaches a packages by name
writeShort.Java

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

Static class to query information about the system
isEof.connection

Checks if the current file position for a connection is at the 'End of File'
enter.Verbose

Writes a message and indents the following output
readShort.Java

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

A PNG device for Bitmap Files via GhostScript
warnings.Verbose

Outputs any warnings recorded
capitalize

Capitalizes/decapitalizes each character string in a vector
getBuiltinHostname.GString

Gets the hostname of the system running R
findGhostscript.System

Searches for the ghostview binary on the current system
dataFrame

Allocates a data frame with given column classes
getBuiltinOs.GString

Gets the operating system of the running machine
getBuiltinTime.GString

Gets the current time
loadToEnv

Method to load objects to a new environment
sourceTo

Parses and evaluates code from a file or a connection
isUrl

Checks if one or several pathnames is URLs
equals.Verbose

Checks if this object is equal to another
setThreshold.Verbose

Sets verbose threshold
mkdirs

Creates a directory including any necessary but nonexistent parent directories
setProgress.ProgressBar

Sets current progress
writeUTF.Java

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

Gets the pathname of the settings file loaded
off.Verbose

Turn off the output
FileProgressBar

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

Checks if the output is on
asInt.Java

Converts an numeric to a Java integer
isOn.NullVerbose

Checks if the output is on
findGraphicsDevice.System

Searches for a working PNG device
MultiVerbose

A Verbose class ignoring everything
reset.ProgressBar

Reset progress bar
arrayIndex

Converts vector indices to array indices
getBuiltinDate.GString

Gets the current date
isScalar.Assert

Static method asserting thatan object is a single value
displayCode

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

A JPEG device for Bitmap Files via GhostScript
Non-documented objects

Non-documented objects
Settings

Class for applicational settings
pushState.Verbose

Pushes the current indentation state of the Verbose object
convertComment.VComments

Converts a verbose comment to R code
more.Verbose

Creates a cloned instance with a lower threshold
less.Verbose

Creates a cloned instance with a higher threshold
saveObject

Saves an object to a file or a connection
setDefaultLevel.Verbose

Sets the current default verbose level
patchCode

Patches installed and loaded packages and more
timestamp.Verbose

Writes a timestamp
reset.SmartComments

Resets a SmartComments compiler
seqToHumanReadable

Gets a short human readable string representation of an vector of indices
print.Verbose

Prints objects if above threshold
finalizeSession

Function to call for finalizing the R session
exit.Verbose

Writes a message and unindents the following output
reassignInPackage

Re-assigns a new value to an existing object in a loaded package
getReadablePathnames.Arguments

Gets a readable pathname
setTicks.ProgressBar

Sets values for which ticks should be visible
increase.ProgressBar

Increases (steps) progress bar
isMatrix.Assert

Static method asserting thatan object is a matrix
getIndices.Arguments

Coerces to a integer vector and validates
getDoubles.Arguments

Coerces to a double vector and validates
readTableIndex

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

Gets the current R version
Verbose

Class to writing verbose messages to a connection or file
setLabels.TextStatusBar

Sets new values of given labels
setStepLength.ProgressBar

Sets default step length
callHooks

Call hook functions by hook name
relibrary

Reloads a package
saveAnywhere.Settings

Saves settings to file
readUTF.Java

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

Writes a integer (32 bits) to a connection in Java format
ruler.Verbose

Writes a ruler
getIntegers.Arguments

Coerces to a integer vector and validates
update.TextStatusBar

Updates the status bar (visually)
getLeaves.Options

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

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

Reshape an array or a matrix by permuting and/or joining dimensions
copyFile

Copies a file safely
writeRaw.NullVerbose

All output methods
gunzip

Gunzip a file
getNumerics.Arguments

Coerces to a numeric vector and validates
remove.FileProgressBar

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

Gets the current date and time
filePath

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

Provides text based counting progress bar
listDirectory

Gets the file names in the directory
Java

Static class for Java related methods
NullVerbose

A Verbose class ignoring everything
promptAndSave.Settings

Prompt user to save modified settings
GString

Character string with advanced substitutions
addFinalizerToLast

Modifies .Last() to call 'finalizeSession()
str.Options

Prints the structure of the options
as.double.Verbose

Gets a numeric value of this object
setLabel.TextStatusBar

Sets the value of a label
str.Verbose

Prints the structure of an object if above threshold
splitByPattern

Splits a single character string by pattern
isZero

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

Sources files recursively to either local or global environment
writeByte.Java

Writes a byte (8 bits) to a connection in Java format
capture.Verbose

Captures output of a function
doCall

Executes a function call with option to ignore unused arguments
getRelativePath

Gets the relative pathname relative to a directory
getAbsolutePath

Gets the absolute pathname string
as.character.binmode

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

Converts a numeric to a Java short
cat.Verbose

Concatenates and prints objects if above threshold
hasUrlProtocol

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

Gets a readable pathname
getLogicals.Arguments

Coerces to a logical vector and validates
parseDebian.System

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

Updates progress bar
getLabel.TextStatusBar

Gets the current value of a label
getRegularExpression.Arguments

Gets a valid regular expression pattern
getRaw.GString

Gets the unprocessed GString
lapply.MultiVerbose

Applies a function to each of the Verbose objects
Arguments

Static class to validate and process arguments
readTable

Reads a file in table format
print.GString

Prints the processed GString
getThreshold.Verbose

Gets current verbose threshold
currentTimeMillis.System

Get the current time in milliseconds
getUsername.System

Retrieves the name of the user running R
flush.TextStatusBar

Flushes the output
intToBin

Converts an integer to a binary/octal/hexadecimal number
getVector.Arguments

Validates a vector
SmartComments

Abstract class SmartComments
loadObject

Method to load object from a file or a connection
getVerbose.Arguments

Coerces to Verbose object
getTimestampFormat.Verbose

Gets the default timestamp format
asByte.Java

Converts a numeric to a Java byte
attachLocally.list

Assigns an objects elements locally
as.character.Options

Returns a character string version of this object
updateLabels.TextStatusBar

Sets the new values of given labels and updates the status bar
compile.SmartComments

Preprocess a vector of code lines
convertComment.SmartComments

Converts a single smart comment to R code
newline.Verbose

Writes one or several empty lines
as.character.GString

Gets the processed character string
timestampOn.Verbose

Turns automatic timestamping on and off
commandArgs

Extract Command Line Arguments
validate.VComments

Validates the compiled lines
extract.array

Extract a subset of an array, matrix or a vector with unknown dimensions
getBarString.ProgressBar

Gets the progress bar string to be displayed
getBuiltinPid.GString

Gets the process id of the current R session
eps

EPS graphics device
Options

The Options class
getVariableValue.GString

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

Gets an existing environment
isAbsolutePath

Checks if this pathname is absolute
getBuiltinRhome.GString

Gets the path where R is installed
isOpen.character

Checks if there is an open connection in Rto a file
insert

Insert values to a vector at certain positions
names.Options

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

Converts a pathname into a URL
isVisible.Verbose

Checks if a certain verbose level will be shown or not
nbrOfOptions.Options

Gets the number of options set
isFile

Checks if the file specification is a file
openBrowser.System

Opens an HTML document using the OS default HTML browser
loadAnywhere.Settings

Loads settings from file
isDirectory

Checks if the file specification is a directory
isPackageLoaded

Checks if a package is loaded or not
isVector.Assert

Static method asserting thatan object is a vector
toCamelCase

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

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

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

Formats and prints object if above threshold
setTimestampFormat.Verbose

Sets the default timestamp format
parse.GString

Parses a GString
as.character.ProgressBar

Gets a string description of the progress bar
callHooks.function

Call hook functions
readInt.Java

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

Writes to each of the Verbose objects
update.FileProgressBar

Updates file progress bar
evaluate.Verbose

Evaluates a function and prints its results if above threshold
isVisible.NullVerbose

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

Gets the string of the parent specified by this pathname
popMessage.TextStatusBar

Adds a message above the status bar
resetWarnings

Resets recorded warnings
VComments

The VComments class
writeRaw.Verbose

Writes objects if above threshold
unwrap.array

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

Sets current value
reset.VComments

Resets a VComments compiler
getCharacters.Arguments

Coerces to a character vector and validates
inherits.Assert

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

Checks if progress bar is completed
parse.SmartComments

Parses one single smart comment
touchFile

Updates the timestamp of a file
Assert

The Assert class
R.utils-package

Package R.utils
check.Assert

Static method asserting that a generic condition is true
LComments

The LComments class
getBuiltinUsername.GString

Gets the username of the user running R
lastModified

Gets the time when the file was last modified
newline.TextStatusBar

Writes a newline
on.Verbose

Turn on the output
readWindowsShortcut

Reads a Microsoft Windows Shortcut (.lnk file)
summary.Verbose

Generates a summary of an object if above threshold
validate.SmartComments

Validates the compiled lines