Learn R Programming

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

R.utils (version 2.12.3)

Various Programming Utilities

Description

Utility functions useful when programming and developing R packages.

Copy Link

Version

Install

install.packages('R.utils')

Monthly Downloads

181,629

Version

2.12.3

License

LGPL (>= 2.1)

Issues

Pull Requests

Stars

Forks

Maintainer

Henrik Bengtsson

Last Published

November 18th, 2023

Functions in R.utils (2.12.3)

LComments

The LComments class
MultiVerbose

A Verbose class ignoring everything
Options

The Options class
Sys.readlink2

Read File Symbolic Links (also on Windows)
SmartComments

Abstract class SmartComments
R.utils-package

Package R.utils
Settings

Class for applicational settings
ProgressBar

Provides text based counting progress bar
as.character.ProgressBar

Gets a string description of the progress bar
System

Static class to query information about the system
as.double.Verbose

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

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

Returns a character string version of this object
Java$asLong

Converts a numeric to a Java long
TextStatusBar

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

The VComments class
Java$asShort

Converts a numeric to a Java short
TimeoutException

TimeoutException represents timeout errors
Java$asByte

Converts a numeric to a Java byte
as.character.GString

Gets the processed character string
capture.Verbose

Captures output of a function
as.list.Options

Gets a list representation of the options
cmdArgs

Simple access to parsed command-line arguments
convertComment.SmartComments

Converts a single smart comment to R code
cleanup.FileProgressBar

Removes the progress file for a file progress bar
attachLocally.list

Assigns an objects elements locally
Java$asInt

Converts an numeric to a Java integer
equals.Options

Checks if this object is equal to another Options object
as.character.Options

Returns a character string version of this object
convertComment.VComments

Converts a verbose comment to R code
Verbose

Class to writing verbose messages to a connection or file
addFinalizerToLast

Modifies .Last() to call 'finalizeSession()
GString$getBuiltinRversion

Gets the current R version
commandArgs

Extract command-line arguments
System$findGhostscript

Searches for a Ghostview executable on the current system
captureOutput

Evaluate an R expression and captures the output
evaluate.Verbose

Evaluates a function and prints its results if above threshold
GString$getBuiltinUsername

Gets the username of the user running R
callHooks

Call hook functions by hook name
getOption.Options

Gets an option
countLines

Counts the number of lines in a text file
createFileAtomically

Creates a file atomically
cat.Verbose

Concatenates and prints objects if above threshold
compile.SmartComments

Preprocess a vector of code lines
enter.Verbose

Writes a message and indents the following output
as.list.MultiVerbose

Gets a list of Verbose objects
callHooks.function

Call hook functions
cmdArgsCall

Calls an R function passing command-line arguments
eget

Gets a variable by name
System$getHostname

Retrieves the computer name of the current host
Assert$check

Static method asserting that a generic condition is true
env

Creates a new environment, evaluates an expression therein, and returns the environment
colClasses

Creates a vector of column classes used for tabular reading
getTimestampFormat.Verbose

Gets the default timestamp format
Settings$findSettings

Searches for the settings file in one or several directories
capitalize

Capitalizes/decapitalizes each character string in a vector
compressFile

Compressing and decompressing files
createLink

Creates a link to a file or a directory
detachPackage

Detaches packages by name
System$currentTimeMillis

Get the current time in milliseconds
doCall

Executes a function call with option to ignore unused arguments
format.binmode

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

Creates a Microsoft Windows Shortcut (.lnk file)
findSourceTraceback

Finds all 'srcfile' objects generated by source() in all call frames
fileAccess

Checks the permission of a file or a directory
compressPDF

Compresses a PDF (into a new PDF)
findFiles

Finds one or several files in multiple directories
dataFrame

Allocates a data frame with given column classes
filePath

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

Extract File Information (acknowledging symbolic file links also on Windows)
names.Options

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

Checks if this object is equal to another
gcat

Parses, evaluates and outputs a GString
GString$getBuiltinOs

Gets the operating system of the running machine
onSessionExit

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

Gets a unique non-existing temporary variable name
dimNA< -

Sets the dimension of an object with the option to infer one dimension automatically
update.TextStatusBar

Updates the status bar (visually)
Arguments$getEnvironment

Gets an existing environment
evaluate.GString

Parses and evaluates a GString
mergeIntervals.numeric

Merges intervals
copyFile

Copies a file atomically
Arguments$getCharacters

Coerces to a character vector and validates
copyDirectory

Copies a directory
GString$getBuiltinDatetime

Gets the current date and time
displayCode

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

Gets a variable value given a name and attributes
downloadFile.character

Downloads a file
draw.density

Draws a density curve
Arguments$getInstanceOf

Gets an instance of the object that is of a particular class
GString$getBuiltinPid

Gets the process id of the current R session
egsub

Global substitute of expression using regular expressions
isPackageLoaded

Checks if a package is loaded or not
hsize

Convert byte sizes into human-readable byte sizes
gcDLLs

Identifies and removes DLLs of packages already unloaded
withSink

Evaluate an R expression while temporarily diverting output
getAbsolutePath

Gets the absolute pathname string
flush.TextStatusBar

Flushes the output
getLeaves.Options

Gets all (non-list) options in a flat list
getMessage.TimeoutException

Gets the message of the exception
Arguments$getReadablePathname

Gets a readable pathname
System$findGraphicsDevice

Searches for a working PNG device
exit.Verbose

Writes a message and unindents the following output
isEof.connection

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

Gets the unprocessed GString
getLabel.TextStatusBar

Gets the current value of a label
finalizeSession

Function to call for finalizing the R session
Java$writeInt

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

Gets the string of the parent specified by this pathname
less.Verbose

Creates a cloned instance with a higher threshold
extract.array

Extract a subset of an array, matrix or a vector with unknown dimensions
GString$getBuiltinTime

Gets the current time
removeDirectory

Removes a directory
GString$getBuiltinHostname

Gets the hostname of the system running R
GString$getBuiltinDate

Gets the current date
Arguments$getVerbose

Coerces to Verbose object
Arguments$getWritablePathname

Gets a writable pathname
Assert$inheritsFrom

Static method asserting that an object inherits from of a certain class
GString$getBuiltinRhome

Gets the path where R is installed
mpager

A \"pager\" function that outputs to standard error
Arguments$getIndices

Coerces to a integer vector and validates
hpaste

Concatenating vectors into human-readable strings
popTemporaryFile

Drops a temporary suffix from the temporary pathname
isOpen.character

Checks if there is an open connection to a file
mkdirs

Creates a directory including any necessary but nonexistent parent directories
lastModified

Gets the time when the file was last modified
Java$readByte

Reads a Java formatted byte (8 bits) from a connection
Arguments$getDoubles

Coerces to a double vector and validates
getBarString.ProgressBar

Gets the progress bar string to be displayed
Arguments$getReadablePathnames

Gets a readable pathname
gstring

Parses and evaluates a GString into a regular string
Arguments$getNumerics

Coerces to a numeric vector and validates
Arguments$getRegularExpression

Gets a valid regular expression pattern
intToBin

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

Validates a vector
installPackages

Install R packages by name or URL
inAnyInterval.numeric

Checks if a set of values are inside one or more intervals
on.Verbose

Turn on the output
System$getUsername

Retrieves the name of the user running R
isVisible.NullVerbose

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

Sets the default timestamp format
isOn.Verbose

Checks if the output is on
Arguments$getFilename

Gets and validates a filename
hasUrlProtocol

Checks if one or several pathnames has a URL protocol
newline.TextStatusBar

Writes a newline
hasOption.Options

Checks if an option exists
isZero

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

Identifies all entries with replicated values
isDirectory

Checks if the file specification is a directory
increase.ProgressBar

Increases (steps) progress bar
more.Verbose

Creates a cloned instance with a lower threshold
isOn.NullVerbose

Checks if the output is on
pushState.Verbose

Pushes the current indentation state of the Verbose object
isPackageInstalled

Checks if a package is installed or not
header.Verbose

Writes a header
intervalsToSeq.matrix

Generates a vector of indices from a matrix of intervals
getRelativePath

Gets the relative pathname relative to a directory
readRdHelp

Reads one or more Rd help files in a certain format
getLoadedPathname.Settings

Gets the pathname of the settings file loaded
loadToEnv

Method to load objects to a new environment
reset.SmartComments

Resets a SmartComments compiler
Assert$isMatrix

Static method asserting that an object is a matrix
isDone.ProgressBar

Checks if progress bar is completed
listDirectory

Gets the file names in the directory
isAbsolutePath

Checks if this pathname is absolute
writeRaw.NullVerbose

All output methods
ruler.Verbose

Writes a ruler
isModified.Settings

Checks if settings has been modified compared to whats on file
Assert$isScalar

Static method asserting that an object is a single value
isUrl

Checks if one or several pathnames is URLs
printf

C-style formatted output
newline.Verbose

Writes one or several empty lines
Arguments$getIntegers

Coerces to a integer vector and validates
saveAnywhere.Settings

Saves settings to file
Java$readUTF

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

Reads a single column from file in table format
Assert$isVector

Static method asserting that an object is a vector
Arguments$getLogicals

Coerces to a logical vector and validates
System$parseDebian

Parses a string, file or connection for Debian formatted parameters
whichVector.logical

Identifies TRUE elements in a logical vector
getThreshold.Verbose

Gets current verbose threshold
setTicks.ProgressBar

Sets values for which ticks should be visible
setProgress.ProgressBar

Sets current progress
nbrOfOptions.Options

Gets the number of options set
isFile

Checks if the file specification is a file
seqToIntervals

Gets all contiguous intervals of a vector of indices
patchCode

Patches installed and loaded packages and more
nullfile

Gets the pathname or a connection to the NULL device on the current platform
setOption

Sets a option in R
print.Verbose

Prints objects if above threshold
mapToIntervals.numeric

Maps values to intervals
popBackupFile

Drops a backup suffix from the backup pathname
isSingle

Identifies all entries that exists exactly once
setLabel.TextStatusBar

Sets the value of a label
pushTemporaryFile

Appends a temporary suffix to the pathname
insert

Insert values to a vector at certain positions
renameFile

Renames a file (or a directory) atomically/safely
System$openBrowser

Opens an HTML document using the OS default HTML browser
Java$readShort

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

Outputs any warnings recorded
readWindowsShellLink

Reads a Microsoft Windows Shortcut (.lnk file)
mout

Miscellaneous functions for outputting via message()
setDefaultLevel.Verbose

Sets the current default verbose level
queryRCmdCheck

Gets the on R CMD check if the current R session was launched by it
summary.Verbose

Generates a summary of an object if above threshold
readBinFragments

Reads binary data from disjoint sections of a connection or a file
validate.SmartComments

Validates the compiled lines
isVisible.Verbose

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

Reads a Microsoft Windows Shortcut (.lnk file)
str.Options

Prints the structure of the options
readTable

Reads a file in table format
writeDataFrame.data.frame

Writes a data.frame to tabular text file
withTimeout

Evaluate an R expression and interrupts it if it takes too long
print.GString

Prints the processed GString
use

Attaches or loads packages
loadAnywhere.Settings

Loads settings from file
popMessage.TextStatusBar

Adds a message above the status bar
reset.VComments

Resets a VComments compiler
off.Verbose

Turn off the output
onGarbageCollect

Registers a function to be called when the R garbage collector is (detected to be) running
resample

Sample values from a set of elements
touchFile

Updates the timestamp of a file
setStepLength.ProgressBar

Sets default step length
setMaxValue.ProgressBar

Sets maximum value
loadObject

Method to load object from a file or a connection
setThreshold.Verbose

Sets verbose threshold
Java$writeShort

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

Re-assigns a new value to an existing object in a loaded package
reset.ProgressBar

Reset progress bar
promptAndSave.Settings

Prompt user to save modified settings
setValue.ProgressBar

Sets current value
swapXY.density

Swaps x and y coordinates of a density object
subplots

Creates a grid of subplots
moveInSearchPath

Moves a environment in the search path to another position
updateLabels.TextStatusBar

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

Evaluate an R expression with repositories set temporarily
setLabels.TextStatusBar

Sets new values of given labels
withCapture

Evaluates an expression and captures the code and/or the output
Java$writeUTF

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

Unwrap an array, matrix or a vector to an array of more dimensions
writeBinFragments

Writes binary data to disjoint sections of a connection or a file
str.Verbose

Prints the structure of an object if above threshold
pushBackupFile

Appends a backup suffix to the pathname
writeRaw.Verbose

Writes objects if above threshold
toCamelCase

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

Writes text in the margin along the sides of a plot
systemR

Launches another R process from within R
splitByPattern

Splits a single character string by pattern
useRepos

Sets package repositories
timestampOn.Verbose

Turns automatic timestamping on and off
saveObject

Saves an object to a file or a connection
shell.exec2

Open a file or URL using Windows File Associations
withSeed

Evaluate an R expression with a temporarily set random set
Java$writeByte

Writes a byte (8 bits) to a connection in Java format
validate.VComments

Validates the compiled lines
seqToHumanReadable

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

Creates a temporary file with content
withLocale

Evaluate an R expression with locale set temporarily
toUrl

Converts a pathname into a URL
withOptions

Evaluate an R expression with options set temporarily
writeRaw.MultiVerbose

Writes to each of the Verbose objects
timestamp.Verbose

Writes a timestamp
parse.GString

Parses a GString
parse.SmartComments

Parses one single smart comment
setOption.Options

Sets an option
printf.Verbose

Formats and prints object if above threshold
Java$readInt

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

Sources files recursively to either local or global environment
sourceTo

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

Updates progress bar
update.FileProgressBar

Updates file progress bar
wrap.array

Reshape an array or a matrix by permuting and/or joining dimensions
Non-documented objects

Non-documented objects
.Last.lib

Undo changed done by this package when detached
Arguments

Static class to validate and process arguments
FileProgressBar

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

The Assert class
GString

Character string with advanced substitutions
NullVerbose

A Verbose class ignoring everything
Java

Static class for Java related methods