Unlimited learning, half price | 50% off
Get 50% off unlimited learning

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

R.utils (version 2.10.1)

Various Programming Utilities

Description

Utility functions useful when programming and developing R packages.

Copy Link

Version

Install

install.packages('R.utils')

Monthly Downloads

226,490

Version

2.10.1

License

LGPL (>= 2.1)

Issues

Pull Requests

Stars

Forks

Maintainer

Henrik Bengtsson

Last Published

August 26th, 2020

Functions in R.utils (2.10.1)

Java

Static class for Java related methods
GString

Character string with advanced substitutions
Non-documented objects

Non-documented objects
Options

The Options class
Arguments

Static class to validate and process arguments
MultiVerbose

A Verbose class ignoring everything
Assert

The Assert class
FileProgressBar

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

The LComments class
NullVerbose

A Verbose class ignoring everything
TextStatusBar

A status bar at the R prompt that can be updated
as.character.Verbose

Returns a character string version of this object
as.double.Verbose

Gets a numeric value of this object
VComments

The VComments class
TimeoutException

TimeoutException represents timeout errors
Verbose

Class to writing verbose messages to a connection or file
Java$asInt

Converts an numeric to a Java integer
Java$asByte

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

Converts a binary/octal/hexadecimal number into a string
R.utils-package

Package R.utils
ProgressBar

Provides text based counting progress bar
as.list.MultiVerbose

Gets a list of Verbose objects
as.character.Options

Returns a character string version of this object
countLines

Counts the number of lines in a text file
callHooks

Call hook functions by hook name
colClasses

Creates a vector of column classes used for tabular reading
cmdArgsCall

Calls an R function passing command-line arguments
attachLocally.list

Assigns an objects elements locally
System

Static class to query information about the system
addFinalizerToLast

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

Captures output of a function
Java$asLong

Converts a numeric to a Java long
createFileAtomically

Creates a file atomically
Sys.readlink2

Read File Symbolic Links (also on Windows)
copyDirectory

Copies a directory
Java$asShort

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

Gets the processed character string
detachPackage

Detaches packages by name
captureOutput

Evaluate an R expression and captures the output
compressPDF

Compresses a PDF (into a new PDF)
compressFile

Compressing and decompressing files
as.character.ProgressBar

Gets a string description of the progress bar
cmdArgs

Simple access to parsed command-line arguments
copyFile

Copies a file atomically
dimNA< -

Sets the dimension of an object with the option to infer one dimension automatically
commandArgs

Extract command-line arguments
downloadFile.character

Downloads a file
cleanup.FileProgressBar

Removes the progress file for a file progress bar
displayCode

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

Executes a function call with option to ignore unused arguments
exit.Verbose

Writes a message and unindents the following output
compile.SmartComments

Preprocess a vector of code lines
convertComment.SmartComments

Converts a single smart comment to R code
egsub

Global substitute of expression using regular expressions
convertComment.VComments

Converts a verbose comment to R code
fileAccess

Checks the permission of a file or a directory
evaluate.GString

Parses and evaluates a GString
eget

Gets a variable by name
System$currentTimeMillis

Get the current time in milliseconds
System$findGraphicsDevice

Searches for a working PNG device
file.info2

Extract File Information (acknowledging symbolic file links also on Windows)
draw.density

Draws a density curve
extract.array

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

Abstract class SmartComments
GString$getBuiltinHostname

Gets the hostname of the system running R
as.list.Options

Gets a list representation of the options
Settings

Class for applicational settings
as.logical.Verbose

Gets a logical value of this object
Arguments$getIndices

Coerces to a integer vector and validates
GString$getBuiltinOs

Gets the operating system of the running machine
dataFrame

Allocates a data frame with given column classes
equals.Verbose

Checks if this object is equal to another
findSourceTraceback

Finds all 'srcfile' objects generated by source() in all call frames
equals.Options

Checks if this object is equal to another Options object
capitalize

Capitalizes/decapitalizes each character string in a vector
callHooks.function

Call hook functions
evaluate.Verbose

Evaluates a function and prints its results if above threshold
findFiles

Finds one or several files in multiple directories
GString$getBuiltinDate

Gets the current date
System$findGhostscript

Searches for a Ghostview executable on the current system
gcDLLs

Identifies and removes DLLs of packages already unloaded
gcat

Parses, evaluates and outputs a GString
Settings$findSettings

Searches for the settings file in one or several directories
GString$getBuiltinRversion

Gets the current R version
hpaste

Concatenating vectors into human-readable strings
GString$getBuiltinTime

Gets the current time
Arguments$getRegularExpression

Gets a valid regular expression pattern
getRelativePath

Gets the relative pathname relative to a directory
header.Verbose

Writes a header
isFile

Checks if the file specification is a file
Assert$check

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

Concatenates and prints objects if above threshold
getLabel.TextStatusBar

Gets the current value of a label
hasOption.Options

Checks if an option exists
GString$getBuiltinDatetime

Gets the current date and time
getMessage.TimeoutException

Gets the message of the exception
Arguments$getIntegers

Coerces to a integer vector and validates
Arguments$getLogicals

Coerces to a logical vector and validates
insert

Insert values to a vector at certain positions
Arguments$getDoubles

Coerces to a double vector and validates
hasUrlProtocol

Checks if one or several pathnames has a URL protocol
Arguments$getEnvironment

Gets an existing environment
filePath

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

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

Creates a Microsoft Windows Shortcut (.lnk file)
enter.Verbose

Writes a message and indents the following output
createLink

Creates a link to a file or a directory
installPackages

Install R packages by name or URL
finalizeSession

Function to call for finalizing the R session
getBarString.ProgressBar

Gets the progress bar string to be displayed
Arguments$getInstanceOf

Gets an instance of the object that is of a particular class
getAbsolutePath

Gets the absolute pathname string
GString$getBuiltinPid

Gets the process id of the current R session
lastModified

Gets the time when the file was last modified
getRaw.GString

Gets the unprocessed GString
getParent

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

Flushes the output
Arguments$getReadablePathname

Gets a readable pathname
GString$getBuiltinRhome

Gets the path where R is installed
isEof.connection

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

Checks if progress bar is completed
Arguments$getFilename

Gets and validates a filename
Arguments$getVector

Validates a vector
intervalsToSeq.matrix

Generates a vector of indices from a matrix of intervals
Arguments$getVerbose

Coerces to Verbose object
GString$getBuiltinUsername

Gets the username of the user running R
Assert$isMatrix

Static method asserting that an object is a matrix
Arguments$getReadablePathnames

Gets a readable pathname
intToBin

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

Coerces to a numeric vector and validates
System$getHostname

Retrieves the computer name of the current host
getOption.Options

Gets an option
getLoadedPathname.Settings

Gets the pathname of the settings file loaded
Assert$isVector

Static method asserting that an object is a vector
System$getUsername

Retrieves the name of the user running R
Arguments$getCharacters

Coerces to a character vector and validates
isVisible.NullVerbose

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

Gets the number of options set
newline.TextStatusBar

Writes a newline
getLeaves.Options

Gets all (non-list) options in a flat list
Arguments$getWritablePathname

Gets a writable pathname
increase.ProgressBar

Increases (steps) progress bar
isPackageInstalled

Checks if a package is installed or not
GString$getVariableValue

Gets a variable value given a name and attributes
less.Verbose

Creates a cloned instance with a higher threshold
gstring

Parses and evaluates a GString into a regular string
isModified.Settings

Checks if settings has been modified compared to whats on file
hsize

Convert byte sizes into human-readable byte sizes
inAnyInterval.numeric

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

Gets current verbose threshold
Assert$inheritsFrom

Static method asserting that an object inherits from of a certain class
isOpen.character

Checks if there is an open connection to a file
pushState.Verbose

Pushes the current indentation state of the Verbose object
isOn.Verbose

Checks if the output is on
newline.Verbose

Writes one or several empty lines
isSingle

Identifies all entries that exists exactly once
mergeIntervals.numeric

Merges intervals
isUrl

Checks if one or several pathnames is URLs
mapToIntervals.numeric

Maps values to intervals
isZero

Checks if a value is (close to) zero or not
isOn.NullVerbose

Checks if the output is on
isVisible.Verbose

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

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

Turn off the output
nullfile

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

A \"pager\" function that outputs to standard error
loadToEnv

Method to load objects to a new environment
popMessage.TextStatusBar

Adds a message above the status bar
popTemporaryFile

Drops a temporary suffix from the temporary pathname
stext

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

Splits a single character string by pattern
isPackageLoaded

Checks if a package is loaded or not
readTableIndex

Reads a single column from file in table format
readTable

Reads a file in table format
pushTemporaryFile

Appends a temporary suffix to the pathname
saveAnywhere.Settings

Saves settings to file
ruler.Verbose

Writes a ruler
mkdirs

Creates a directory including any necessary but nonexistent parent directories
toCamelCase

Converts a string of words into a merged camel-cased word
names.Options

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

Converts a pathname into a URL
validate.SmartComments

Validates the compiled lines
validate.VComments

Validates the compiled lines
Java$readUTF

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

Miscellaneous functions for outputting via message()
onGarbageCollect

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

Creates a cloned instance with a lower threshold
parse.SmartComments

Parses one single smart comment
moveInSearchPath

Moves a environment in the search path to another position
System$parseDebian

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

Registers a function to be called when the R session finishes
reset.SmartComments

Resets a SmartComments compiler
readWindowsShellLink

Reads a Microsoft Windows Shortcut (.lnk file)
printf

C-style formatted output
on.Verbose

Turn on the output
printf.Verbose

Formats and prints object if above threshold
popBackupFile

Drops a backup suffix from the backup pathname
renameFile

Renames a file (or a directory) atomically/safely
patchCode

Patches installed and loaded packages and more
writeDataFrame.data.frame

Writes a data.frame to tabular text file
getTimestampFormat.Verbose

Gets the default timestamp format
queryRCmdCheck

Gets the on R CMD check if the current R session was launched by it
removeDirectory

Removes a directory
Java$writeInt

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

Reads binary data from disjoint sections of a connection or a file
Java$readByte

Reads a Java formatted byte (8 bits) from a connection
reset.VComments

Resets a VComments compiler
pushBackupFile

Appends a backup suffix to the pathname
readRdHelp

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

Prompt user to save modified settings
Java$readShort

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

Sample values from a set of elements
Java$readInt

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

Gets all contiguous intervals of a vector of indices
reset.ProgressBar

Reset progress bar
setTimestampFormat.Verbose

Sets the default timestamp format
setDefaultLevel.Verbose

Sets the current default verbose level
setTicks.ProgressBar

Sets values for which ticks should be visible
setLabel.TextStatusBar

Sets the value of a label
setMaxValue.ProgressBar

Sets maximum value
setStepLength.ProgressBar

Sets default step length
isReplicated

Identifies all entries with replicated values
isAbsolutePath

Checks if this pathname is absolute
isDirectory

Checks if the file specification is a directory
Assert$isScalar

Static method asserting that an object is a single value
listDirectory

Gets the file names in the directory
System$openBrowser

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

Loads settings from file
setValue.ProgressBar

Sets current value
setLabels.TextStatusBar

Sets new values of given labels
update.TextStatusBar

Updates the status bar (visually)
systemR

Launches another R process from within R
swapXY.density

Swaps x and y coordinates of a density object
setThreshold.Verbose

Sets verbose threshold
str.Verbose

Prints the structure of an object if above threshold
str.Options

Prints the structure of the options
update.FileProgressBar

Updates file progress bar
update.ProgressBar

Updates progress bar
warnings.Verbose

Outputs any warnings recorded
writeBinFragments

Writes binary data to disjoint sections of a connection or a file
Java$writeByte

Writes a byte (8 bits) to a connection in Java format
updateLabels.TextStatusBar

Sets the new values of given labels and updates the status bar
whichVector.logical

Identifies TRUE elements in a logical vector
shell.exec2

Open a file or URL using Windows File Associations
timestampOn.Verbose

Turns automatic timestamping on and off
setOption.Options

Sets an option
subplots

Creates a grid of subplots
wrap.array

Reshape an array or a matrix by permuting and/or joining dimensions
writeRaw.NullVerbose

All output methods
writeRaw.MultiVerbose

Writes to each of the Verbose objects
withTimeout

Evaluate an R expression and interrupts it if it takes too long
withCapture

Evaluates an expression and captures the code and/or the output
writeRaw.Verbose

Writes objects if above threshold
summary.Verbose

Generates a summary of an object if above threshold
withLocale

Evaluate an R expression with locale set temporarily
tmpfile

Creates a temporary file with content
Java$writeShort

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

Evaluate an R expression with repositories set temporarily
touchFile

Updates the timestamp of a file
withOptions

Evaluate an R expression with options set temporarily
unwrap.array

Unwrap an array, matrix or a vector to an array of more dimensions
Java$writeUTF

Writes a string to a connection in Java format (UTF-8)
print.GString

Prints the processed GString
parse.GString

Parses a GString
print.Verbose

Prints objects if above threshold
reassignInPackage

Re-assigns a new value to an existing object in a loaded package
setOption

Sets a option in R
readWindowsShortcut

Reads a Microsoft Windows Shortcut (.lnk file)
saveObject

Saves an object to a file or a connection
seqToHumanReadable

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

Sources files recursively to either local or global environment
setProgress.ProgressBar

Sets current progress
sourceTo

Parses and evaluates code from a file or a connection
tempvar

Gets a unique non-existing temporary variable name
timestamp.Verbose

Writes a timestamp
useRepos

Sets package repositories
withSeed

Evaluate an R expression with a temporarily set random set
use

Attaches or loads packages
withSink

Evaluate an R expression while temporarily diverting output