Learn R Programming

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

R.utils (version 2.2.0)

Various Programming Utilities

Description

Utility functions useful when programming and developing R packages.

Copy Link

Version

Install

install.packages('R.utils')

Monthly Downloads

171,037

Version

2.2.0

License

LGPL (>= 2.1)

Issues

Pull Requests

Stars

Forks

Maintainer

Henrik Bengtsson

Last Published

December 11th, 2015

Functions in R.utils (2.2.0)

as.character.Verbose

Returns a character string version of this object
captureOutput

Evaluate an R expression and captures the output
callHooks.function

Call hook functions
copyDirectory

Copies a directory
cat.Verbose

Concatenates and prints objects if above threshold
Arguments$getDoubles

Coerces to a double vector and validates
Arguments

Static class to validate and process arguments
Arguments$getVerbose

Coerces to Verbose object
createLink

Creates a link to a file or a directory
capture.Verbose

Captures output of a function
VComments

The VComments class
arrayIndex

Converts vector indices to array indices
Java$asLong

Converts a numeric to a Java long
Settings

Class for applicational settings
copyFile

Copies a file atomically
System$currentTimeMillis

Get the current time in milliseconds
draw.density

Draws a density curve
isAbsolutePath

Checks if this pathname is absolute
doCall

Executes a function call with option to ignore unused arguments
gcat

Parses, evaluates and outputs a GString
Non-documented objects

Non-documented objects
Java$asShort

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

Converts a binary/octal/hexadecimal number into a string
dimNA< -

Sets the dimension of an object with the option to infer one dimension autmatically
addFinalizerToLast

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

Writes a message and indents the following output
compressPDF

Compresses a PDF (into a new PDF)
Verbose

Class to writing verbose messages to a connection or file
compressFile

Compressing and decompressing files
GString$getBuiltinUsername

Gets the username of the user running R
Java$asInt

Converts an numeric to a Java integer
findFiles

Finds one or several files in multiple directories
less.Verbose

Creates a cloned instance with a higher threshold
createFileAtomically

Creates a file atomically
callHooks

Call hook functions by hook name
GString$getBuiltinTime

Gets the current time
flush.TextStatusBar

Flushes the output
mergeIntervals.numeric

Merges intervals
Settings$findSettings

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

Sets new values of given labels
Assert$isScalar

Static method asserting thatan object is a single value
getThreshold.Verbose

Gets current verbose threshold
isOn.NullVerbose

Checks if the output is on
Arguments$getEnvironment

Gets an existing environment
GString$getBuiltinRversion

Gets the current R version
as.character.GString

Gets the processed character string
exit.Verbose

Writes a message and unindents the following output
fileAccess

Checks the permission of a file or a directory
extract.array

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

Method to load object from a file or a connection
pushBackupFile

Appends a backup suffix to the pathname
Arguments$getReadablePathnames

Gets a readable pathname
isEof.connection

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

Gets a unique non-existing temporary variable name
Assert$inherits

Static method asserting that an object inherits from of a certain class
getOption.Options

Gets an option
withSink

Evaluate an R expression while temporarily diverting output
as.list.MultiVerbose

Gets a list of Verbose objects
pushState.Verbose

Pushes the current indentation state of the Verbose object
getAbsolutePath

Gets the absolute pathname string
colClasses

Creates a vector of column classes used for tabular reading
isDirectory

Checks if the file specification is a directory
hasUrlProtocol

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

Gets a writable pathname
Arguments$getIndices

Coerces to a integer vector and validates
print.GString

Prints the processed GString
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
filePath

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

Gets a short human readable string representation of an vector of indices
System$findGraphicsDevice

Searches for a working PNG device
setThreshold.Verbose

Sets verbose threshold
System$getUsername

Retrieves the name of the user running R
mpager

A "pager" function that outputs to standard error
isDone.ProgressBar

Checks if progress bar is completed
Assert$isMatrix

Static method asserting thatan object is a matrix
displayCode

Displays the contents of a text file with line numbers and more
getMessage.TimeoutException

Gets the message of the exception
sourceDirectory

Sources files recursively to either local or global environment
print.Verbose

Prints objects if above threshold
saveObject

Saves an object to a file or a connection
use

Attaches or loads packages
insert

Insert values to a vector at certain positions
isModified.Settings

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

Install R packages by name or URL
parse.GString

Parses a GString
getParent

Gets the string of the parent specified by this pathname
onSessionExit

Registers a function to be called when the R session finishes
popMessage.TextStatusBar

Adds a message above the status bar
inAnyInterval.numeric

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

Concatenating vectors into human-readable strings
summary.Verbose

Generates a summary of an object if above threshold
seqToIntervals

Gets all contigous intervals of a vector of indices
PERCENT< -PERCENT

Assignment operator for delayed assignments ('lazy future')
subplots

Creates a grid of subplots
intToBin

Converts an integer to a binary/octal/hexadecimal number
detachPackage

Detaches packages by name
Assert

The Assert class
isOn.Verbose

Checks if the output is on
System

Static class to query information about the system
str.Options

Prints the structure of the options
finalizeSession

Function to call for finalizing the R session
promptAndSave.Settings

Prompt user to save modified settings
TimeoutException

TimeoutException represents timeout errors
LComments

The LComments class
evaluate.Verbose

Evaluates a function and prints its results if above threshold
on.Verbose

Turn on the output
sourceTo

Parses and evaluates code from a file or a connection
timestamp.Verbose

Writes a timestamp
update.ProgressBar

Updates progress bar
writeDataFrame.data.frame

Writes a data.frame to tabular text file
Arguments$getReadablePathname

Gets a readable pathname
countLines

Counts the number of lines in a text file
str.Verbose

Prints the structure of an object if above threshold
Java$readUTF

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

Identifies all entries with replicated values
pushTemporaryFile

Appends a temporary suffix to the pathname
evaluate.GString

Parses and evaluates a GString
Arguments$getFilename

Gets and validates a filename
Java$writeByte

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

Gets a logical value of this object
GString$getBuiltinOs

Gets the operating system of the running machine
newline.Verbose

Writes one or several empty lines
readWindowsShortcut

Reads a Microsoft Windows Shortcut (.lnk file)
touchFile

Updates the timestamp of a file
header.Verbose

Writes a header
unwrap.array

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

A Verbose class ignoring everything
loadToEnv

Method to load objects to a new environment
Assert$isVector

Static method asserting thatan object is a vector
getLabel.TextStatusBar

Gets the current value of a label
withCapture

Evaluates an expression and captures the code and/or the output
as.character.Options

Returns a character string version of this object
env

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

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

Evaluate an R expression with options set temporarily
Java$writeInt

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

Sets the default timestamp format
as.double.Verbose

Gets a numeric value of this object
convertComment.VComments

Converts a verbose comment to R code
isSingle

Identifies all entries that exists exactly ones
Arguments$getRegularExpression

Gets a valid regular expression pattern
parse.SmartComments

Parses one single smart comment
timestampOn.Verbose

Turns automatic timestamping on and off
FileProgressBar

A progress bar that sets the size of a file accordingly
getRaw.GString

Gets the unprocessed GString
Java$asByte

Converts a numeric to a Java byte
writeRaw.Verbose

Writes objects if above threshold
Java$writeUTF

Writes a string to a connection in Java format (UTF-8)
Arguments$getVector

Validates a vector
isVisible.NullVerbose

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

Checks if a value is (close to) zero or not
GString$getBuiltinRhome

Gets the path where R is installed
toUrl

Converts a pathname into a URL
capitalize

Capitalizes/decapitalizes each character string in a vector
mapToIntervals.numeric

Maps values to intervals
setValue.ProgressBar

Sets current value
isFile

Checks if the file specification is a file
printf

C-style formatted output
GString

Character string with advanced substitutions
readTableIndex

Reads a single column from file in table format
Arguments$getNumerics

Coerces to a numeric vector and validates
resetWarnings

Resets recorded warnings
onGarbageCollect

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

Gets the relative pathname relative to a directory
isOpen.character

Checks if there is an open connection to a file
Java

Static class for Java related methods
cmdArgs

Simple access to parsed command-line arguments
System$getHostname

Retrieves the computer name of the current host
queryRCmdCheck

Gets the on R CMD check if the current R session was launched by it
loadAnywhere.Settings

Loads settings from file
System$parseDebian

Parses a string, file or connection for Debian formatted parameters
System$findGhostscript

Searches for a Ghostview executable on the current system
equals.Verbose

Checks if this object is equal to another
mout

Miscellaneous functions for outputting via message()
ProgressBar

Provides text based counting progress bar
GString$getBuiltinPid

Gets the process id of the current R session
moveInSearchPath

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

Creates a cloned instance with a lower threshold
Sys.readlink2

Read File Symbolic Links (also on Windows)
getLeaves.Options

Gets all (non-list) options in a flat list
setDefaultLevel.Verbose

Sets the current default verbose level
getTimestampFormat.Verbose

Gets the default timestamp format
patchCode

Patches installed and loaded packages and more
equals.Options

Checks if this object is equal to another Options object
GString$getBuiltinHostname

Gets the hostname of the system running R
SmartComments

Abstract class SmartComments
cleanup.FileProgressBar

Removes the progress file for a file progress bar
writeRaw.NullVerbose

All output methods
intervalsToSeq.matrix

Generates a vector of indices from a matrix of intervals
setLabel.TextStatusBar

Sets the value of a label
updateLabels.TextStatusBar

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

Reads binary data from disjoint sections of a connection or a file
setProgress.ProgressBar

Sets current progress
as.list.Options

Gets a list representation of the options
nbrOfOptions.Options

Gets the number of options set
newline.TextStatusBar

Writes a newline
GString$getBuiltinDate

Gets the current date
popBackupFile

Drops a backup suffix from the backup pathname
Java$writeShort

Writes a short (16 bits) to a connection in Java format
saveAnywhere.Settings

Saves settings to file
update.TextStatusBar

Updates the status bar (visually)
attachLocally.list

Assigns an objects elements locally
setOption.Options

Sets an option
createWindowsShortcut

Creates a Microsoft Windows Shortcut (.lnk file)
getBarString.ProgressBar

Gets the progress bar string to be displayed
resample

Sample values from a set of elements
setOption

Sets a option in R
Options

The Options class
NullVerbose

A Verbose class ignoring everything
TextStatusBar

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

Evaluate an R expression with locale set temporarily
as.character.ProgressBar

Gets a string description of the progress bar
splitByPattern

Splits a single character string by pattern
isVisible.Verbose

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

Writes text in the margin along the sides of a plot
convertComment.SmartComments

Converts a single smart comment to R code
commandArgs

Extract command-line arguments
findSourceTraceback

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

Global substitute of expression using regular expressions
setStepLength.ProgressBar

Sets default step length
off.Verbose

Turn off the output
systemR

Launches another R process from within R
dataFrame

Allocates a data frame with given column classes
reset.ProgressBar

Reset progress bar
getLoadedPathname.Settings

Gets the pathname of the settings file loaded
Assert$check

Static method asserting that a generic condition is true
Arguments$getLogicals

Coerces to a logical vector and validates
cmdArgsCall

Calls an R function passing command-line arguments
update.FileProgressBar

Updates file progress bar
printf.Verbose

Formats and prints object if above threshold
popTemporaryFile

Drops a temporary suffix from the temporary pathname
downloadFile.character

Downloads a file
R.utils-package

Package R.utils
renameFile

Renames a file (or a directory) atomically/safely
hasOption.Options

Checks if an option exists
setTicks.ProgressBar

Sets values for which ticks should be visible
compile.SmartComments

Preprocess a vector of code lines
Arguments$getCharacters

Coerces to a character vector and validates
reset.VComments

Resets a VComments compiler
withRepos

Evaluate an R expression with repositories set temporarily
writeBinFragments

Writes binary data to disjoint sections of a connection or a file
GString$getVariableValue

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

Coerces to a integer vector and validates
removeDirectory

Removes a directory
eget

Gets a variable by name
listDirectory

Gets the file names in the directory
increase.ProgressBar

Increases (steps) progress bar
Java$readInt

Reads a Java formatted int (32 bits) from a connection
Java$readShort

Reads a Java formatted short (16 bits) from a connection
GString$getBuiltinDatetime

Gets the current date and time
Arguments$getInstanceOf

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

Evaluate an R expression and interrupts it if it takes too long
names.Options

Gets the full pathname of all (non-list) options
setMaxValue.ProgressBar

Sets maximum value
System$openBrowser

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

Outputs any warnings recorded
readTable

Reads a file in table format
isPackageLoaded

Checks if a package is loaded or not
ruler.Verbose

Writes a ruler
readRdHelp

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

Checks if a package is installed or not
writeRaw.MultiVerbose

Writes to each of the Verbose objects
validate.VComments

Validates the compiled lines
reset.SmartComments

Resets a SmartComments compiler
swapXY.density

Swaps x and y coordinates of a density object
whichVector.logical

Identifies TRUE elements in a logical vector
file.info2

Extract File Information (acknowledging symbolic file links also on Windows)
wrap.array

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

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

Reads a Microsoft Windows Shortcut (.lnk file)
withSeed

Evaluate an R expression with a temporarily set random set
validate.SmartComments

Validates the compiled lines
useRepos

Sets package repositories
isUrl

Checks if one or several pathnames is URLs
shell.exec2

Open a file or URL using Windows File Associations