Learn R Programming

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

R.utils (version 1.34.0)

Various programming utilities

Description

This package provides utility methods useful when programming and developing R packages.

Copy Link

Version

Install

install.packages('R.utils')

Monthly Downloads

192,589

Version

1.34.0

License

LGPL (>= 2.1)

Issues

Pull Requests

Stars

Forks

Maintainer

Henrik Bengtsson

Last Published

October 8th, 2014

Functions in R.utils (1.34.0)

GString

Character string with advanced substitutions
convertComment.SmartComments

Converts a single smart comment to R code
as.character.Options

Returns a character string version of this object
Non-documented objects

Non-documented objects
copyDirectory

Copies a directory
callHooks

Call hook functions by hook name
as.character.GString

Gets the processed character string
as.list.MultiVerbose

Gets a list of Verbose objects
Options

The Options class
Java$asLong

Converts a numeric to a Java long
enter.Verbose

Writes a message and indents the following output
Settings

Class for applicational settings
Arguments$getDoubles

Coerces to a double vector and validates
capture.Verbose

Captures output of a function
TimeoutException

TimeoutException represents timeout errors
MultiVerbose

A Verbose class ignoring everything
Java

Static class for Java related methods
System$currentTimeMillis

Get the current time in milliseconds
arrayIndex

Converts vector indices to array indices
Arguments

Static class to validate and process arguments
getAbsolutePath

Gets the absolute pathname string
Verbose

Class to writing verbose messages to a connection or file
Arguments$getCharacters

Coerces to a character vector and validates
gcat

Parses, evaluates and outputs a GString
commandArgs

Extract command-line arguments
draw.density

Draws a density curve
addFinalizerToLast

Modifies .Last() to call 'finalizeSession()
Java$asByte

Converts a numeric to a Java byte
Java$asShort

Converts a numeric to a Java short
env

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

Global substitute of expression using regular expressions
getTimestampFormat.Verbose

Gets the default timestamp format
R.utils-package

Package R.utils
listDirectory

Gets the file names in the directory
detachPackage

Detaches packages by name
captureOutput

Evaluate an R expression and captures the output
as.character.binmode

Converts a binary/octal/hexadecimal number into a string
getMessage.TimeoutException

Gets the message of the exception
colClasses

Creates a vector of column classes used for tabular reading
dataFrame

Allocates a data frame with given column classes
increase.ProgressBar

Increases (steps) progress bar
as.character.Verbose

Returns a character string version of this object
GString$getBuiltinTime

Gets the current time
as.logical.Verbose

Gets a logical value of this object
eget

Gets a variable by name
isAbsolutePath

Checks if this pathname is absolute
fileAccess

Checks the permission of a file or a directory
Assert$isMatrix

Static method asserting thatan object is a matrix
dimNA< -

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

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

Parses and evaluates a GString
SmartComments

Abstract class SmartComments
compile.SmartComments

Preprocess a vector of code lines
as.character.ProgressBar

Gets a string description of the progress bar
doCall

Executes a function call with option to ignore unused arguments
createFileAtomically

Creates a file atomically
displayCode

Displays the contents of a text file with line numbers and more
exit.Verbose

Writes a message and unindents the following output
filePath

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

Calls an R function passing command-line arguments
Arguments$getFilename

Gets and validates a filename
System$findGraphicsDevice

Searches for a working PNG device
attachLocally.list

Assigns an objects elements locally
pushState.Verbose

Pushes the current indentation state of the Verbose object
finalizeSession

Function to call for finalizing the R session
as.list.Options

Gets a list representation of the options
GString$getBuiltinDatetime

Gets the current date and time
hasOption.Options

Checks if an option exists
createWindowsShortcut

Creates a Microsoft Windows Shortcut (.lnk file)
GString$getBuiltinRversion

Gets the current R version
PERCENT< -PERCENT

Assignment operator for delayed assignments
ProgressBar

Provides text based counting progress bar
copyFile

Copies a file atomically
isModified.Settings

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

Extract File Information (acknowledging symbolic file links also on Windows)
popMessage.TextStatusBar

Adds a message above the status bar
GString$getBuiltinUsername

Gets the username of the user running R
Arguments$getEnvironment

Gets an existing environment
getOption.Options

Gets an option
isZero

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

Checks if the file specification is a file
GString$getVariableValue

Gets a variable value given a name and attributes
loadObject

Method to load object from a file or a connection
cmdArgs

Simple access to parsed command-line arguments
printf

C-style formatted output
mout

Miscellaneous functions for outputting via message()
stext

Writes text in the margin along the sides of a plot
names.Options

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

Identifies all entries that exists exactly ones
lastModified

Gets the time when the file was last modified
intToBin

Converts an integer to a binary/octal/hexadecimal number
isOn.Verbose

Checks if the output is on
nbrOfOptions.Options

Gets the number of options set
print.GString

Prints the processed GString
header.Verbose

Writes a header
getLabel.TextStatusBar

Gets the current value of a label
Arguments$getVerbose

Coerces to Verbose object
GString$getBuiltinRhome

Gets the path where R is installed
Java$readByte

Reads a Java formatted byte (8 bits) from a connection
readTableIndex

Reads a single column from file in table format
onGarbageCollect

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

Merges intervals
isDirectory

Checks if the file specification is a directory
getBarString.ProgressBar

Gets the progress bar string to be displayed
withRepos

Evaluate an R expression with repositories set temporarily
toUrl

Converts a pathname into a URL
withCapture

Evaluates an expression and captures the code and/or the output
System$getHostname

Retrieves the computer name of the current host
readWindowsShortcut

Reads a Microsoft Windows Shortcut (.lnk file)
withLocale

Evaluate an R expression with locale set temporarily
Arguments$getReadablePathname

Gets a readable pathname
Assert$inherits

Static method asserting that an object inherits from of a certain class
setStepLength.ProgressBar

Sets default step length
equals.Options

Checks if this object is equal to another Options object
isReplicated

Identifies all entries with replicated values
Java$writeInt

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

Checks if this object is equal to another
isOn.NullVerbose

Checks if the output is on
setMaxValue.ProgressBar

Sets maximum value
patchCode

Patches installed and loaded packages and more
isOpen.character

Checks if there is an open connection to a file
Settings$findSettings

Searches for the settings file in one or several directories
unwrap.array

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

Creates a directory including any necessary but nonexistent parent directories
Sys.readlink2

Read File Symbolic Links (also on Windows)
Arguments$getIntegers

Coerces to a integer vector and validates
findFiles

Finds one or several files in multiple directories
getLeaves.Options

Gets all (non-list) options in a flat list
getLoadedPathname.Settings

Gets the pathname of the settings file loaded
GString$getBuiltinHostname

Gets the hostname of the system running R
update.TextStatusBar

Updates the status bar (visually)
GString$getBuiltinOs

Gets the operating system of the running machine
saveAnywhere.Settings

Saves settings to file
Arguments$getReadablePathnames

Gets a readable pathname
timestampOn.Verbose

Turns automatic timestamping on and off
getParent

Gets the string of the parent specified by this pathname
popBackupFile

Drops a backup suffix from the backup pathname
setProgress.ProgressBar

Sets current progress
VComments

The VComments class
installPackages

Install R packages by name or URL
getThreshold.Verbose

Gets current verbose threshold
TextStatusBar

A status bar at the R prompt that can be updated
Arguments$getRegularExpression

Gets a valid regular expression pattern
isUrl

Checks if one or several pathnames is URLs
print.Verbose

Prints objects if above threshold
isPackageLoaded

Checks if a package is loaded or not
gzip

Gzip/Gunzip a file
cleanup.FileProgressBar

Removes the progress file for a file progress bar
onSessionExit

Registers a function to be called when the R session finishes
System$openBrowser

Opens an HTML document using the OS default HTML browser
update.ProgressBar

Updates progress bar
loadToEnv

Method to load objects to a new environment
parse.GString

Parses a GString
intervalsToSeq.matrix

Generates a vector of indices from a matrix of intervals
readTable

Reads a file in table format
on.Verbose

Turn on the output
Arguments$getNumerics

Coerces to a numeric vector and validates
wrap.array

Reshape an array or a matrix by permuting and/or joining dimensions
inAnyInterval.numeric

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

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

Concatenates and prints objects if above threshold
setLabel.TextStatusBar

Sets the value of a label
Assert$isScalar

Static method asserting thatan object is a single value
hasUrlProtocol

Checks if one or several pathnames has a URL protocol
isPackageInstalled

Checks if a package is installed or not
readBinFragments

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

Reads a Microsoft Windows Shortcut (.lnk file)
setLabels.TextStatusBar

Sets new values of given labels
saveObject

Saves an object to a file or a connection
promptAndSave.Settings

Prompt user to save modified settings
Java$writeUTF

Writes a string to a connection in Java format (UTF-8)
reset.SmartComments

Resets a SmartComments compiler
moveInSearchPath

Moves a environment in the search path to another position
mapToIntervals.numeric

Maps values to intervals
timestamp.Verbose

Writes a timestamp
extract.array

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

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

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

Sets a option in R
resample

Sample values from a set of elements
Java$writeShort

Writes a short (16 bits) to a connection in Java format
validate.VComments

Validates the compiled lines
setTicks.ProgressBar

Sets values for which ticks should be visible
tempvar

Gets a unique non-existing temporary variable name
readRdHelp

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

Evaluate an R expression with a temporarily set random set
toCamelCase

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

Launches another R process from within R
off.Verbose

Turn off the output
touchFile

Updates the timestamp of a file
writeRaw.Verbose

Writes objects if above threshold
insert

Insert values to a vector at certain positions
seqToIntervals

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

Creates a cloned instance with a lower threshold
withTimeout

Evaluate an R expression and interrupts it if it takes too long
setThreshold.Verbose

Sets verbose threshold
updateLabels.TextStatusBar

Sets the new values of given labels and updates the status bar
newline.Verbose

Writes one or several empty lines
warnings.Verbose

Outputs any warnings recorded
validate.SmartComments

Validates the compiled lines
useRepos

Sets package repositories
str.Options

Prints the structure of the options
setOption.Options

Sets an option
callHooks.function

Call hook functions
evaluate.Verbose

Evaluates a function and prints its results if above threshold
swapXY.density

Swaps x and y coordinates of a density object
getRelativePath

Gets the relative pathname relative to a directory
splitByPattern

Splits a single character string by pattern
summary.Verbose

Generates a summary of an object if above threshold
System$getUsername

Retrieves the name of the user running R
ruler.Verbose

Writes a ruler
writeBinFragments

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

Creates a link to a file or a directory
Arguments$getVector

Validates a vector
Java$writeByte

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

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

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

Checks if progress bar is completed
whichVector.logical

Identifies TRUE elements in a logical vector
seqToHumanReadable

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

Sources files recursively to either local or global environment
writeRaw.MultiVerbose

Writes to each of the Verbose objects
loadAnywhere.Settings

Loads settings from file
isVisible.Verbose

Checks if a certain verbose level will be shown or not
newline.TextStatusBar

Writes a newline
resetWarnings

Resets recorded warnings
str.Verbose

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

Updates file progress bar
System

Static class to query information about the system
capitalize

Capitalizes/decapitalizes each character string in a vector
GString$getBuiltinPid

Gets the process id of the current R session
GString$getBuiltinDate

Gets the current date
findSourceTraceback

Finds all 'srcfile' objects generated by source() in all call frames
Assert$isVector

Static method asserting thatan object is a vector
LComments

The LComments class
pushBackupFile

Appends a backup suffix to the pathname
Java$asInt

Converts an numeric to a Java integer
downloadFile.character

Downloads a file
System$parseDebian

Parses a string, file or connection for Debian formatted parameters
Arguments$getWritablePathname

Gets a writable pathname
pushTemporaryFile

Appends a temporary suffix to the pathname
reset.ProgressBar

Reset progress bar
isEof.connection

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

Checks if a certain verbose level will be shown or not
Java$readInt

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

Reads a Java (UTF-8) formatted string from a connection
reset.VComments

Resets a VComments compiler
shell.exec2

Open a file or URL using Windows File Associations
sourceTo

Parses and evaluates code from a file or a connection
use

Attaches or loads packages
setValue.ProgressBar

Sets current value
setDefaultLevel.Verbose

Sets the current default verbose level
writeRaw.NullVerbose

All output methods
Arguments$getInstanceOf

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

Removes a directory
as.double.Verbose

Gets a numeric value of this object
Assert

The Assert class
System$findGhostscript

Searches for a Ghostview executable on the current system
bunzip2

Bunzip a file
Arguments$getLogicals

Coerces to a logical vector and validates
getRaw.GString

Gets the unprocessed GString
hpaste

Concatenating vectors into human-readable strings
less.Verbose

Creates a cloned instance with a higher threshold
parse.SmartComments

Parses one single smart comment
printf.Verbose

Formats and prints object if above threshold
subplots

Creates a grid of subplots
reassignInPackage

Re-assigns a new value to an existing object in a loaded package
setTimestampFormat.Verbose

Sets the default timestamp format
NullVerbose

A Verbose class ignoring everything
Assert$check

Static method asserting that a generic condition is true
convertComment.VComments

Converts a verbose comment to R code
flush.TextStatusBar

Flushes the output
Arguments$getIndices

Coerces to a integer vector and validates
popTemporaryFile

Drops a temporary suffix from the temporary pathname
Java$readShort

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

Evaluate an R expression while temporarily diverting output