Learn R Programming

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

R.utils (version 2.6.0)

Various Programming Utilities

Description

Utility functions useful when programming and developing R packages.

Copy Link

Version

Install

install.packages('R.utils')

Monthly Downloads

191,979

Version

2.6.0

License

LGPL (>= 2.1)

Issues

Pull Requests

Stars

Forks

Last Published

November 5th, 2017

Functions in R.utils (2.6.0)

TextStatusBar

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

Call hook functions by hook name
callHooks.function

Call hook functions
compile.SmartComments

Preprocess a vector of code lines
compressFile

Compressing and decompressing files
copyFile

Copies a file atomically
countLines

Counts the number of lines in a text file
doCall

Executes a function call with option to ignore unused arguments
downloadFile.character

Downloads a file
NullVerbose

A Verbose class ignoring everything
Options

The Options class
equals.Options

Checks if this object is equal to another Options object
env

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

The VComments class
Verbose

Class to writing verbose messages to a connection or file
Settings$findSettings

Searches for the settings file in one or several directories
findSourceTraceback

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

A Verbose class ignoring everything
Arguments$getInstanceOf

Gets an instance of the object that is of a particular class
Arguments$getIntegers

Coerces to a integer vector and validates
getLoadedPathname.Settings

Gets the pathname of the settings file loaded
Arguments$getLogicals

Coerces to a logical vector and validates
as.character.GString

Gets the processed character string
as.character.Options

Returns a character string version of this object
capitalize

Capitalizes/decapitalizes each character string in a vector
capture.Verbose

Captures output of a function
Java

Static class for Java related methods
Non-documented objects

Non-documented objects
addFinalizerToLast

Modifies .Last() to call 'finalizeSession()
captureOutput

Evaluate an R expression and captures the output
getRelativePath

Gets the relative pathname relative to a directory
cat.Verbose

Concatenates and prints objects if above threshold
Java$asShort

Converts a numeric to a Java short
arrayIndex

Converts vector indices to array indices
getThreshold.Verbose

Gets current verbose threshold
attachLocally.list

Assigns an objects elements locally
LComments

The LComments class
compressPDF

Compresses a PDF (into a new PDF)
hasUrlProtocol

Checks if one or several pathnames has a URL protocol
Sys.readlink2

Read File Symbolic Links (also on Windows)
fileAccess

Checks the permission of a file or a directory
System

Static class to query information about the system
convertComment.SmartComments

Converts a single smart comment to R code
filePath

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

Gets a list of Verbose objects
egsub

Global substitute of expression using regular expressions
finalizeSession

Function to call for finalizing the R session
header.Verbose

Writes a header
isAbsolutePath

Checks if this pathname is absolute
intervalsToSeq.matrix

Generates a vector of indices from a matrix of intervals
findFiles

Finds one or several files in multiple directories
as.list.Options

Gets a list representation of the options
Arguments

Static class to validate and process arguments
Assert

The Assert class
GString$getBuiltinOs

Gets the operating system of the running machine
as.logical.Verbose

Gets a logical value of this object
Settings

Class for applicational settings
GString$getBuiltinPid

Gets the process id of the current R session
Java$asByte

Converts a numeric to a Java byte
isPackageInstalled

Checks if a package is installed or not
isOpen.character

Checks if there is an open connection to a file
isZero

Checks if a value is (close to) zero or not
Arguments$getCharacters

Coerces to a character vector and validates
SmartComments

Abstract class SmartComments
lastModified

Gets the time when the file was last modified
Arguments$getDoubles

Coerces to a double vector and validates
colClasses

Creates a vector of column classes used for tabular reading
getRaw.GString

Gets the unprocessed GString
FileProgressBar

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

Extract command-line arguments
Arguments$getReadablePathname

Gets a readable pathname
GString

Character string with advanced substitutions
GString$getBuiltinTime

Gets the current time
enter.Verbose

Writes a message and indents the following output
GString$getBuiltinUsername

Gets the username of the user running R
names.Options

Gets the full pathname of all (non-list) options
R.utils-package

Package R.utils
ProgressBar

Provides text based counting progress bar
createFileAtomically

Creates a file atomically
createLink

Creates a link to a file or a directory
getLabel.TextStatusBar

Gets the current value of a label
cmdArgs

Simple access to parsed command-line arguments
getLeaves.Options

Gets all (non-list) options in a flat list
draw.density

Draws a density curve
hpaste

Concatenating vectors into human-readable strings
nbrOfOptions.Options

Gets the number of options set
as.character.binmode

Converts a binary/octal/hexadecimal number into a string
extract.array

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

Gets a variable by name
on.Verbose

Turn on the output
as.double.Verbose

Gets a numeric value of this object
file.info2

Extract File Information (acknowledging symbolic file links also on Windows)
Java$asInt

Converts an numeric to a Java integer
Java$asLong

Converts a numeric to a Java long
Assert$check

Static method asserting that a generic condition is true
cleanup.FileProgressBar

Removes the progress file for a file progress bar
hsize

Convert byte sizes into human-readable byte sizes
GString$getVariableValue

Gets a variable value given a name and attributes
Arguments$getVector

Validates a vector
dataFrame

Allocates a data frame with given column classes
detachPackage

Detaches packages by name
copyDirectory

Copies a directory
convertComment.VComments

Converts a verbose comment to R code
isOn.NullVerbose

Checks if the output is on
isOn.Verbose

Checks if the output is on
evaluate.GString

Parses and evaluates a GString
equals.Verbose

Checks if this object is equal to another
flush.TextStatusBar

Flushes the output
isEof.connection

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

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

Checks if the file specification is a file
popTemporaryFile

Drops a temporary suffix from the temporary pathname
gcDLLs

Identifies and removes DLLs of packages already unloaded
Assert$isScalar

Static method asserting thatan object is a single value
isSingle

Identifies all entries that exists exactly once
cmdArgsCall

Calls an R function passing command-line arguments
GString$getBuiltinRhome

Gets the path where R is installed
print.GString

Prints the processed GString
System$findGhostscript

Searches for a Ghostview executable on the current system
Java$readShort

Reads a Java formatted short (16 bits) from a connection
isVisible.NullVerbose

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

Reads a file in table format
GString$getBuiltinRversion

Gets the current R version
isVisible.Verbose

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

Creates a Microsoft Windows Shortcut (.lnk file)
reset.VComments

Resets a VComments compiler
System$findGraphicsDevice

Searches for a working PNG device
GString$getBuiltinDatetime

Gets the current date and time
System$currentTimeMillis

Get the current time in milliseconds
loadAnywhere.Settings

Loads settings from file
onSessionExit

Registers a function to be called when the R session finishes
Arguments$getEnvironment

Gets an existing environment
resetWarnings

Resets recorded warnings
System$openBrowser

Opens an HTML document using the OS default HTML browser
print.Verbose

Prints objects if above threshold
GString$getBuiltinHostname

Gets the hostname of the system running R
Arguments$getFilename

Gets and validates a filename
loadObject

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

Creates a cloned instance with a lower threshold
printf

C-style formatted output
getMessage.TimeoutException

Gets the message of the exception
readWindowsShellLink

Reads a Microsoft Windows Shortcut (.lnk file)
Arguments$getRegularExpression

Gets a valid regular expression pattern
Arguments$getReadablePathnames

Gets a readable pathname
setOption.Options

Sets an option
setMaxValue.ProgressBar

Sets maximum value
mout

Miscellaneous functions for outputting via message()
Arguments$getVerbose

Coerces to Verbose object
popBackupFile

Drops a backup suffix from the backup pathname
Arguments$getNumerics

Coerces to a numeric vector and validates
dimNA< -

Sets the dimension of an object with the option to infer one dimension autmatically
getTimestampFormat.Verbose

Gets the default timestamp format
readWindowsShortcut

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

Sets verbose threshold
setStepLength.ProgressBar

Sets default step length
displayCode

Displays the contents of a text file with line numbers and more
swapXY.density

Swaps x and y coordinates of a density object
systemR

Launches another R process from within R
setOption

Sets a option in R
setProgress.ProgressBar

Sets current progress
validate.SmartComments

Validates the compiled lines
touchFile

Updates the timestamp of a file
evaluate.Verbose

Evaluates a function and prints its results if above threshold
Arguments$getWritablePathname

Gets a writable pathname
sourceDirectory

Sources files recursively to either local or global environment
Assert$inherits

Static method asserting that an object inherits from of a certain class
exit.Verbose

Writes a message and unindents the following output
sourceTo

Parses and evaluates code from a file or a connection
System$getUsername

Retrieves the name of the user running R
unwrap.array

Unwrap an array, matrix or a vector to an array of more dimensions
update.FileProgressBar

Updates file progress bar
gcat

Parses, evaluates and outputs a GString
update.ProgressBar

Updates progress bar
getAbsolutePath

Gets the absolute pathname string
getBarString.ProgressBar

Gets the progress bar string to be displayed
inAnyInterval.numeric

Checks if a set of values are inside one or more intervals
increase.ProgressBar

Increases (steps) progress bar
validate.VComments

Validates the compiled lines
popMessage.TextStatusBar

Adds a message above the status bar
GString$getBuiltinDate

Gets the current date
System$getHostname

Retrieves the computer name of the current host
isDirectory

Checks if the file specification is a directory
Arguments$getIndices

Coerces to a integer vector and validates
pushBackupFile

Appends a backup suffix to the pathname
withTimeout

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

Insert values to a vector at certain positions
pushState.Verbose

Pushes the current indentation state of the Verbose object
isDone.ProgressBar

Checks if progress bar is completed
isUrl

Checks if one or several pathnames is URLs
isPackageLoaded

Checks if a package is loaded or not
isReplicated

Identifies all entries with replicated values
wrap.array

Reshape an array or a matrix by permuting and/or joining dimensions
Assert$isVector

Static method asserting thatan object is a vector
less.Verbose

Creates a cloned instance with a higher threshold
readTableIndex

Reads a single column from file in table format
listDirectory

Gets the file names in the directory
loadToEnv

Method to load objects to a new environment
Java$readUTF

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

Gets an option
Java$writeUTF

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

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

Writes a ruler
nullfile

Gets the pathname of the NULL device on the current platform
saveAnywhere.Settings

Saves settings to file
seqToIntervals

Gets all contigous intervals of a vector of indices
printf.Verbose

Formats and prints object if above threshold
off.Verbose

Turn off the output
gstring

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

Prompt user to save modified settings
setDefaultLevel.Verbose

Sets the current default verbose level
mapToIntervals.numeric

Maps values to intervals
setTicks.ProgressBar

Sets values for which ticks should be visible
hasOption.Options

Checks if an option exists
setTimestampFormat.Verbose

Sets the default timestamp format
Java$readInt

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

Reads one or more Rd help files in a certain format
installPackages

Install R packages by name or URL
subplots

Creates a grid of subplots
intToBin

Converts an integer to a binary/octal/hexadecimal number
newline.TextStatusBar

Writes a newline
Assert$isMatrix

Static method asserting thatan object is a matrix
summary.Verbose

Generates a summary of an object if above threshold
isModified.Settings

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

Renames a file (or a directory) atomically/safely
newline.Verbose

Writes one or several empty lines
use

Attaches or loads packages
mergeIntervals.numeric

Merges intervals
System$parseDebian

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

Creates a directory including any necessary but nonexistent parent directories
useRepos

Sets package repositories
moveInSearchPath

Moves a environment in the search path to another position
mpager

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

Sample values from a set of elements
saveObject

Saves an object to a file or a connection
parse.GString

Parses a GString
reset.ProgressBar

Reset progress bar
patchCode

Patches installed and loaded packages and more
withRepos

Evaluate an R expression with repositories set temporarily
withOptions

Evaluate an R expression with options set temporarily
parse.SmartComments

Parses one single smart comment
writeRaw.Verbose

Writes objects if above threshold
seqToHumanReadable

Gets a short human readable string representation of an vector of indices
reset.SmartComments

Resets a SmartComments compiler
pushTemporaryFile

Appends a temporary suffix to the pathname
queryRCmdCheck

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

Splits a single character string by pattern
Java$writeShort

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

Reads a Java formatted byte (8 bits) from a connection
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
stext

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

Gets a unique non-existing temporary variable name
removeDirectory

Removes a directory
setLabel.TextStatusBar

Sets the value of a label
setValue.ProgressBar

Sets current value
shell.exec2

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

Writes a timestamp
setLabels.TextStatusBar

Sets new values of given labels
toCamelCase

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

Prints the structure of the options
toUrl

Converts a pathname into a URL
str.Verbose

Prints the structure of an object if above threshold
update.TextStatusBar

Updates the status bar (visually)
withCapture

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

Turns automatic timestamping on and off
updateLabels.TextStatusBar

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

Evaluate an R expression with a temporarily set random set
withLocale

Evaluate an R expression with locale set temporarily
writeDataFrame.data.frame

Writes a data.frame to tabular text file
tmpfile

Creates a temporary file with content
writeBinFragments

Writes binary data to disjoint sections of a connection or a file
withSink

Evaluate an R expression while temporarily diverting output
Java$writeByte

Writes a byte (8 bits) to a connection in Java format
Java$writeInt

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

Outputs any warnings recorded
whichVector.logical

Identifies TRUE elements in a logical vector
writeRaw.MultiVerbose

Writes to each of the Verbose objects
writeRaw.NullVerbose

All output methods
TimeoutException

TimeoutException represents timeout errors
as.character.ProgressBar

Gets a string description of the progress bar
as.character.Verbose

Returns a character string version of this object