Learn R Programming

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

R.utils (version 2.1.0)

Various Programming Utilities

Description

Utility functions useful when programming and developing R packages.

Copy Link

Version

Install

install.packages('R.utils')

Monthly Downloads

192,589

Version

2.1.0

License

LGPL (>= 2.1)

Issues

Pull Requests

Stars

Forks

Maintainer

Henrik Bengtsson

Last Published

May 28th, 2015

Functions in R.utils (2.1.0)

R.utils-package

Package R.utils
Sys.readlink2

Read File Symbolic Links (also on Windows)
Non-documented objects

Non-documented objects
as.character.Options

Returns a character string version of this object
FileProgressBar

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

Writes a message and indents the following output
ProgressBar

Provides text based counting progress bar
TimeoutException

TimeoutException represents timeout errors
Java$asLong

Converts a numeric to a Java long
SmartComments

Abstract class SmartComments
Arguments$getNumerics

Coerces to a numeric vector and validates
Arguments$getIndices

Coerces to a integer vector and validates
getRaw.GString

Gets the unprocessed GString
getRelativePath

Gets the relative pathname relative to a directory
Java$readShort

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

Gets a numeric value of this object
cmdArgsCall

Calls an R function passing command-line arguments
compile.SmartComments

Preprocess a vector of code lines
compressPDF

Compresses a PDF (into a new PDF)
GString$getBuiltinRversion

Gets the current R version
dimNA< -

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

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

Converts a numeric to a Java byte
PERCENT< -PERCENT

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

The VComments class
Settings$findSettings

Searches for the settings file in one or several directories
egsub

Global substitute of expression using regular expressions
Options

The Options class
callHooks

Call hook functions by hook name
as.character.GString

Gets the processed character string
System$getHostname

Retrieves the computer name of the current host
colClasses

Creates a vector of column classes used for tabular reading
NullVerbose

A Verbose class ignoring everything
Arguments

Static class to validate and process arguments
attachLocally.list

Assigns an objects elements locally
System$currentTimeMillis

Get the current time in milliseconds
evaluate.GString

Parses and evaluates a GString
getAbsolutePath

Gets the absolute pathname string
hasOption.Options

Checks if an option exists
commandArgs

Extract command-line arguments
getLoadedPathname.Settings

Gets the pathname of the settings file loaded
isVisible.Verbose

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

Concatenates and prints objects if above threshold
cmdArgs

Simple access to parsed command-line arguments
timestamp.Verbose

Writes a timestamp
MultiVerbose

A Verbose class ignoring everything
swapXY.density

Swaps x and y coordinates of a density object
callHooks.function

Call hook functions
Java$asInt

Converts an numeric to a Java integer
Arguments$getVector

Validates a vector
update.TextStatusBar

Updates the status bar (visually)
TextStatusBar

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

Downloads a file
capitalize

Capitalizes/decapitalizes each character string in a vector
extract.array

Extract a subset of an array, matrix or a vector with unknown dimensions
Assert$inherits

Static method asserting that an object inherits from of a certain class
Arguments$getVerbose

Coerces to Verbose object
isDirectory

Checks if the file specification is a directory
Assert$check

Static method asserting that a generic condition is true
GString$getBuiltinDate

Gets the current date
less.Verbose

Creates a cloned instance with a higher threshold
convertComment.SmartComments

Converts a single smart comment to R code
gcat

Parses, evaluates and outputs a GString
countLines

Counts the number of lines in a text file
env

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

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

Gets a logical value of this object
GString$getBuiltinTime

Gets the current time
LComments

The LComments class
exit.Verbose

Writes a message and unindents the following output
createFileAtomically

Creates a file atomically
Assert$isMatrix

Static method asserting thatan object is a matrix
readTable

Reads a file in table format
Arguments$getFilename

Gets and validates a filename
GString

Character string with advanced substitutions
isFile

Checks if the file specification is a file
System$getUsername

Retrieves the name of the user running R
GString$getBuiltinRhome

Gets the path where R is installed
on.Verbose

Turn on the output
System$parseDebian

Parses a string, file or connection for Debian formatted parameters
print.GString

Prints the processed GString
GString$getVariableValue

Gets a variable value given a name and attributes
getLabel.TextStatusBar

Gets the current value of a label
as.character.ProgressBar

Gets a string description of the progress bar
getOption.Options

Gets an option
printf

C-style formatted output
isVisible.NullVerbose

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

Gets the time when the file was last modified
evaluate.Verbose

Evaluates a function and prints its results if above threshold
detachPackage

Detaches packages by name
Arguments$getDoubles

Coerces to a double vector and validates
moveInSearchPath

Moves a environment in the search path to another position
eget

Gets a variable by name
Arguments$getIntegers

Coerces to a integer vector and validates
Arguments$getWritablePathname

Gets a writable pathname
setLabels.TextStatusBar

Sets new values of given labels
wrap.array

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

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

Checks if there is an open connection to a file
GString$getBuiltinHostname

Gets the hostname of the system running R
draw.density

Draws a density curve
equals.Options

Checks if this object is equal to another Options object
update.FileProgressBar

Updates file progress bar
Arguments$getReadablePathnames

Gets a readable pathname
flush.TextStatusBar

Flushes the output
Assert

The Assert class
Arguments$getEnvironment

Gets an existing environment
listDirectory

Gets the file names in the directory
GString$getBuiltinUsername

Gets the username of the user running R
arrayIndex

Converts vector indices to array indices
Arguments$getInstanceOf

Gets an instance of the object that is of a particular class
reset.VComments

Resets a VComments compiler
getLeaves.Options

Gets all (non-list) options in a flat list
isDone.ProgressBar

Checks if progress bar is completed
writeRaw.NullVerbose

All output methods
capture.Verbose

Captures output of a function
withLocale

Evaluate an R expression with locale set temporarily
installPackages

Install R packages by name or URL
ruler.Verbose

Writes a ruler
GString$getBuiltinPid

Gets the process id of the current R session
insert

Insert values to a vector at certain positions
setThreshold.Verbose

Sets verbose threshold
whichVector.logical

Identifies TRUE elements in a logical vector
System$findGhostscript

Searches for a Ghostview executable on the current system
isEof.connection

Checks if the current file position for a connection is at the 'End of File'
Assert$isVector

Static method asserting thatan object is a vector
removeDirectory

Removes a directory
getMessage.TimeoutException

Gets the message of the exception
popTemporaryFile

Drops a temporary suffix from the temporary pathname
isUrl

Checks if one or several pathnames is URLs
readWindowsShellLink

Reads a Microsoft Windows Shortcut (.lnk file)
saveAnywhere.Settings

Saves settings to file
onSessionExit

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

Evaluate an R expression and captures the output
createLink

Creates a link to a file or a directory
tempvar

Gets a unique non-existing temporary variable name
findSourceTraceback

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

Allocates a data frame with given column classes
popMessage.TextStatusBar

Adds a message above the status bar
withTimeout

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

Method to load object from a file or a connection
Arguments$getReadablePathname

Gets a readable pathname
more.Verbose

Creates a cloned instance with a lower threshold
setOption

Sets a option in R
str.Options

Prints the structure of the options
System$findGraphicsDevice

Searches for a working PNG device
queryRCmdCheck

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

Writes one or several empty lines
copyFile

Copies a file atomically
touchFile

Updates the timestamp of a file
hpaste

Concatenating vectors into human-readable strings
warnings.Verbose

Outputs any warnings recorded
readWindowsShortcut

Reads a Microsoft Windows Shortcut (.lnk file)
patchCode

Patches installed and loaded packages and more
pushTemporaryFile

Appends a temporary suffix to the pathname
mkdirs

Creates a directory including any necessary but nonexistent parent directories
file.info2

Extract File Information (acknowledging symbolic file links also on Windows)
resetWarnings

Resets recorded warnings
readBinFragments

Reads binary data from disjoint sections of a connection or a file
readRdHelp

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

Converts a string of words into a merged camel-cased word
shell.exec2

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

Pushes the current indentation state of the Verbose object
Java$asShort

Converts a numeric to a Java short
getBarString.ProgressBar

Gets the progress bar string to be displayed
newline.TextStatusBar

Writes a newline
print.Verbose

Prints objects if above threshold
summary.Verbose

Generates a summary of an object if above threshold
Settings

Class for applicational settings
renameFile

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

Finds one or several files in multiple directories
useRepos

Sets package repositories
saveObject

Saves an object to a file or a connection
isReplicated

Identifies all entries with replicated values
off.Verbose

Turn off the output
unwrap.array

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

Sample values from a set of elements
compressFile

Compressing and decompressing files
addFinalizerToLast

Modifies .Last() to call 'finalizeSession()
Assert$isScalar

Static method asserting thatan object is a single value
splitByPattern

Splits a single character string by pattern
setDefaultLevel.Verbose

Sets the current default verbose level
Arguments$getCharacters

Coerces to a character vector and validates
nbrOfOptions.Options

Gets the number of options set
doCall

Executes a function call with option to ignore unused arguments
as.list.Options

Gets a list representation of the options
use

Attaches or loads packages
withOptions

Evaluate an R expression with options set temporarily
seqToIntervals

Gets all contigous intervals of a vector of indices
toUrl

Converts a pathname into a URL
reset.SmartComments

Resets a SmartComments compiler
setValue.ProgressBar

Sets current value
GString$getBuiltinDatetime

Gets the current date and time
sourceTo

Parses and evaluates code from a file or a connection
promptAndSave.Settings

Prompt user to save modified settings
popBackupFile

Drops a backup suffix from the backup pathname
convertComment.VComments

Converts a verbose comment to R code
Arguments$getRegularExpression

Gets a valid regular expression pattern
validate.VComments

Validates the compiled lines
loadToEnv

Method to load objects to a new environment
displayCode

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

Appends a backup suffix to the pathname
Arguments$getLogicals

Coerces to a logical vector and validates
increase.ProgressBar

Increases (steps) progress bar
withSeed

Evaluate an R expression with a temporarily set random set
as.character.Verbose

Returns a character string version of this object
Java

Static class for Java related methods
createWindowsShortcut

Creates a Microsoft Windows Shortcut (.lnk file)
isSingle

Identifies all entries that exists exactly ones
parse.GString

Parses a GString
setOption.Options

Sets an option
sourceDirectory

Sources files recursively to either local or global environment
seqToHumanReadable

Gets a short human readable string representation of an vector of indices
as.character.binmode

Converts a binary/octal/hexadecimal number into a string
as.list.MultiVerbose

Gets a list of Verbose objects
finalizeSession

Function to call for finalizing the R session
System$openBrowser

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

Checks if this object is equal to another
writeDataFrame.data.frame

Writes a data.frame to tabular text file
setTicks.ProgressBar

Sets values for which ticks should be visible
cleanup.FileProgressBar

Removes the progress file for a file progress bar
updateLabels.TextStatusBar

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

Copies a directory
isPackageLoaded

Checks if a package is loaded or not
hasUrlProtocol

Checks if one or several pathnames has a URL protocol
fileAccess

Checks the permission of a file or a directory
isOn.Verbose

Checks if the output is on
getParent

Gets the string of the parent specified by this pathname
GString$getBuiltinOs

Gets the operating system of the running machine
printf.Verbose

Formats and prints object if above threshold
isZero

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

Evaluate an R expression while temporarily diverting output
str.Verbose

Prints the structure of an object if above threshold
readTableIndex

Reads a single column from file in table format
reset.ProgressBar

Reset progress bar
loadAnywhere.Settings

Loads settings from file
getThreshold.Verbose

Gets current verbose threshold
mapToIntervals.numeric

Maps values to intervals
getTimestampFormat.Verbose

Gets the default timestamp format
isAbsolutePath

Checks if this pathname is absolute
header.Verbose

Writes a header
Java$readUTF

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

Sets default step length
intervalsToSeq.matrix

Generates a vector of indices from a matrix of intervals
inAnyInterval.numeric

Checks if a set of values are inside one or more intervals
isOn.NullVerbose

Checks if the output is on
isPackageInstalled

Checks if a package is installed or not
stext

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

Re-assigns a new value to an existing object in a loaded package
mergeIntervals.numeric

Merges intervals
isModified.Settings

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

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

A "pager" function that outputs to standard error
mout

Miscellaneous functions for outputting via message()
intToBin

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

Creates a grid of subplots
writeBinFragments

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

Writes a short (16 bits) to a connection in Java format
timestampOn.Verbose

Turns automatic timestamping on and off
setLabel.TextStatusBar

Sets the value of a label
onGarbageCollect

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

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

Reads a Java formatted byte (8 bits) from a connection
parse.SmartComments

Parses one single smart comment
Java$readInt

Reads a Java formatted int (32 bits) from a connection
setTimestampFormat.Verbose

Sets the default timestamp format
writeRaw.MultiVerbose

Writes to each of the Verbose objects
setProgress.ProgressBar

Sets current progress
withRepos

Evaluate an R expression with repositories set temporarily
withCapture

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

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

Launches another R process from within R
writeRaw.Verbose

Writes objects if above threshold
update.ProgressBar

Updates progress bar
validate.SmartComments

Validates the compiled lines
setMaxValue.ProgressBar

Sets maximum value
Java$writeByte

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