Learn R Programming

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

R.utils (version 1.26.2)

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

163,892

Version

1.26.2

License

LGPL (>= 2.1)

Maintainer

Henrik Bengtsson

Last Published

July 30th, 2013

Functions in R.utils (1.26.2)

callHooks

Call hook functions by hook name
as.list.MultiVerbose

Gets a list of Verbose objects
exit.Verbose

Writes a message and unindents the following output
findSourceTraceback

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

Simple access to parsed command-line arguments
TextStatusBar

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

Call hook functions
evaluate.GString

Parses and evaluates a GString
isOn.NullVerbose

Checks if the output is on
LComments

The LComments class
isOpen.character

Checks if there is an open connection to a file
NullVerbose

A Verbose class ignoring everything
Java

Static class for Java related methods
Settings

Class for applicational settings
cleanup.FileProgressBar

Removes the progress file for a file progress bar
dataFrame

Allocates a data frame with given column classes
Arguments

Static class to validate and process arguments
System

Static class to query information about the system
finalizeSession

Function to call for finalizing the R session
as.double.Verbose

Gets a numeric value of this object
compile.SmartComments

Preprocess a vector of code lines
TimeoutException

TimeoutException represents timeout errors
getLabel.TextStatusBar

Gets the current value of a label
createLink

Creates a link to a file or a directory
parse.GString

Parses a GString
SmartComments

Abstract class SmartComments
GString$getBuiltinDate

Gets the current date
ProgressBar

Provides text based counting progress bar
createWindowsShortcut

Creates a Microsoft Windows Shortcut (.lnk file)
Assert

The Assert class
hpaste

Concatenating vectors into human-readable strings
filePath

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

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

Bunzip a file
as.character.GString

Gets the processed character string
loadAnywhere.Settings

Loads settings from file
isPackageLoaded

Checks if a package is loaded or not
addFinalizerToLast

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

A Verbose class ignoring everything
findFiles

Finds one or several files in multiple directories
isFile

Checks if the file specification is a file
copyFile

Copies a file safely
System$getHostname

Retrieves the computer name of the current host
getBarString.ProgressBar

Gets the progress bar string to be displayed
countLines

Counts the number of lines in a text file
Arguments$getLogicals

Coerces to a logical vector and validates
intToBin

Converts an integer to a binary/octal/hexadecimal number
Settings$findSettings

Searches for the settings file in one or several directories
capitalize

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

Writes a message and indents the following output
fileAccess

Checks the permission of a file or a directory
Java$asByte

Converts a numeric to a Java byte
copyDirectory

Copies a directory
attachLocally.list

Assigns an objects elements locally
as.character.ProgressBar

Gets a string description of the progress bar
createFileAtomically

Creates a file atomically
popBackupFile

Drops a backup suffix from the backup pathname
GString$getBuiltinUsername

Gets the username of the user running R
flush.TextStatusBar

Flushes the output
Arguments$getRegularExpression

Gets a valid regular expression pattern
extract.array

Extract a subset of an array, matrix or a vector with unknown dimensions
getRaw.GString

Gets the unprocessed GString
GString

Character string with advanced substitutions
VComments

The VComments class
FileProgressBar

A progress bar that sets the size of a file accordingly
System$findGhostscript

Searches for a Ghostview executable on the current system
GString$getBuiltinRversion

Gets the current R version
as.list.Options

Gets a list representation of the options
Options

The Options class
as.character.Options

Returns a character string version of this object
Java$asShort

Converts a numeric to a Java short
System$findGraphicsDevice

Searches for a working PNG device
print.Verbose

Prints objects if above threshold
commandArgs

Extract command-line arguments
Assert$isVector

Static method asserting thatan object is a vector
names.Options

Gets the full pathname of all (non-list) options
Java$readInt

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

Method to load objects to a new environment
Verbose

Class to writing verbose messages to a connection or file
GString$getBuiltinTime

Gets the current time
Java$asLong

Converts a numeric to a Java long
convertComment.SmartComments

Converts a single smart comment to R code
Java$readUTF

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

Gets an option
System$currentTimeMillis

Get the current time in milliseconds
off.Verbose

Turn off the output
displayCode

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

Gets a logical value of this object
moveInSearchPath

Moves a environment in the search path to another position
Java$asInt

Converts an numeric to a Java integer
getAbsolutePath

Gets the absolute pathname string
R.utils-package

Package R.utils
equals.Verbose

Checks if this object is equal to another
GString$getBuiltinHostname

Gets the hostname of the system running R
getThreshold.Verbose

Gets current verbose threshold
convertComment.VComments

Converts a verbose comment to R code
Arguments$getCharacters

Coerces to a character vector and validates
Arguments$getReadablePathname

Gets a readable pathname
arrayIndex

Converts vector indices to array indices
Arguments$getWritablePathname

Gets a writable pathname
isOn.Verbose

Checks if the output is on
draw.density

Draws a density curve
removeDirectory

Removes a directory
GString$getBuiltinDatetime

Gets the current date and time
queryRCmdCheck

Gets the on R CMD check if the current R session was launched by it
downloadFile.character

Downloads a file
renameFile

Renames a file safely
newline.TextStatusBar

Writes a newline
printf

C-style formatted output
mergeIntervals.numeric

Merges intervals
newline.Verbose

Writes one or several empty lines
getLeaves.Options

Gets all (non-list) options in a flat list
as.character.binmode

Converts a binary/octal/hexadecimal number into a string
GString$getVariableValue

Gets a variable value given a name and attributes
hasOption.Options

Checks if an option exists
getMessage.TimeoutException

Gets the message of the exception
setThreshold.Verbose

Sets verbose threshold
validate.SmartComments

Validates the compiled lines
evalCapture

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

Writes objects if above threshold
saveAnywhere.Settings

Saves settings to file
resample

Sample values from a set of elements
Arguments$getEnvironment

Gets an existing environment
str.Options

Prints the structure of the options
evalWithTimeout

Evaluate an R expression and interrupts it if it takes too long
GString$getBuiltinOs

Gets the operating system of the running machine
resetWarnings

Resets recorded warnings
gcat

Parses, evaluates and outputs a GString
warnings.Verbose

Outputs any warnings recorded
ruler.Verbose

Writes a ruler
Arguments$getNumerics

Coerces to a numeric vector and validates
seqToHumanReadable

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

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

Gets the string of the parent specified by this pathname
System$getUsername

Retrieves the name of the user running R
isVisible.Verbose

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

Gzip/Gunzip a file
sourceTo

Parses and evaluates code from a file or a connection
Arguments$getInstanceOf

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

Sets a option in R
popMessage.TextStatusBar

Adds a message above the status bar
System$openBrowser

Opens an HTML document using the OS default HTML browser
readWindowsShortcut

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

Prints the structure of an object if above threshold
setValue.ProgressBar

Sets current value
Arguments$getIntegers

Coerces to a integer vector and validates
Arguments$getDoubles

Coerces to a double vector and validates
loadObject

Method to load object from a file or a connection
onSessionExit

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

Coerces to Verbose object
Assert$isScalar

Static method asserting thatan object is a single value
inAnyInterval.numeric

Checks if a set of values are inside one or more intervals
unwrap.array

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

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

Gets the pathname of the settings file loaded
Arguments$getIndices

Coerces to a integer vector and validates
isVisible.NullVerbose

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

Formats and prints object if above threshold
getTimestampFormat.Verbose

Gets the default timestamp format
stext

Writes text in the margin along the sides of a plot
validate.VComments

Validates the compiled lines
readTableIndex

Reads a single column from file in table format
header.Verbose

Writes a header
patchCode

Patches installed and loaded packages and more
subplots

Creates a grid of subplots
Assert$inherits

Static method asserting that an object inherits from of a certain class
seqToIntervals

Gets all contigous intervals of a vector of indices
readTable

Reads a file in table format
getRelativePath

Gets the relative pathname relative to a directory
lastModified

Gets the time when the file was last modified
Assert$isMatrix

Static method asserting thatan object is a matrix
setProgress.ProgressBar

Sets current progress
Java$writeInt

Writes a integer (32 bits) to a connection in Java format
System$parseDebian

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

Checks if a package is installed or not
writeBinFragments

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

Drops a temporary suffix from the temporary pathname
mapToIntervals.numeric

Maps values to intervals
Java$writeByte

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

Appends a temporary suffix to the pathname
updateLabels.TextStatusBar

Sets the new values of given labels and updates the status bar
setOption.Options

Sets an option
wrap.array

Reshape an array or a matrix by permuting and/or joining dimensions
update.FileProgressBar

Updates file progress bar
splitByPattern

Splits a single character string by pattern
pushState.Verbose

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

Sets default step length
hasUrlProtocol

Checks if one or several pathnames has a URL protocol
promptAndSave.Settings

Prompt user to save modified settings
reset.ProgressBar

Reset progress bar
insert

Insert values to a vector at certain positions
pushBackupFile

Appends a backup suffix to the pathname
update.TextStatusBar

Updates the status bar (visually)
setTicks.ProgressBar

Sets values for which ticks should be visible
nbrOfOptions.Options

Gets the number of options set
reset.SmartComments

Resets a SmartComments compiler
systemR

Launches another R process from within R
Arguments$getVector

Validates a vector
isUrl

Checks if one or several pathnames is URLs
swapXY.density

Swaps x and y coordinates of a density object
saveObject

Saves an object to a file or a connection
reset.VComments

Resets a VComments compiler
toUrl

Converts a pathname into a URL
on.Verbose

Turn on the output
increase.ProgressBar

Increases (steps) progress bar
readRdHelp

Reads one or more Rd help files in a certain format
setMaxValue.ProgressBar

Sets maximum value
writeDataFrame.data.frame

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

Generates a summary of an object if above threshold
setTimestampFormat.Verbose

Sets the default timestamp format
Java$writeUTF

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

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

Updates the timestamp of a file
writeRaw.NullVerbose

All output methods
timestampOn.Verbose

Turns automatic timestamping on and off
whichVector.logical

Identifies TRUE elements in a logical vector
equals.Options

Checks if this object is equal to another Options object
evaluate.Verbose

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

Gets and validates a filename
isDirectory

Checks if the file specification is a directory
isReplicated

Identifies all entries with replicated values
isDone.ProgressBar

Checks if progress bar is completed
isZero

Checks if a value is (close to) zero or not
parse.SmartComments

Parses one single smart comment
Java$readByte

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

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

Sets the current default verbose level
setLabels.TextStatusBar

Sets new values of given labels
timestamp.Verbose

Writes a timestamp
eget

Gets a variable by name
detachPackage

Detaches a packages by name
isAbsolutePath

Checks if this pathname is absolute
isSingle

Identifies all entries that exists exactly ones
more.Verbose

Creates a cloned instance with a lower threshold
setLabel.TextStatusBar

Sets the value of a label
reassignInPackage

Re-assigns a new value to an existing object in a loaded package
update.ProgressBar

Updates progress bar
isModified.Settings

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

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

Static method asserting that a generic condition is true
as.character.Verbose

Returns a character string version of this object
cat.Verbose

Concatenates and prints objects if above threshold
GString$getBuiltinRhome

Gets the path where R is installed
Non-documented objects

Non-documented objects
capture.Verbose

Captures output of a function
env

Creates a new environment, evaluates an expression therein, and returns the environment
GString$getBuiltinPid

Gets the process id of the current R session
colClasses

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

Prints the processed GString
listDirectory

Gets the file names in the directory
less.Verbose

Creates a cloned instance with a higher threshold
isEof.connection

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

Gets a readable pathname
Java$readShort

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

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

Generates a vector of indices from a matrix of intervals
sourceDirectory

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

Writes to each of the Verbose objects
doCall

Executes a function call with option to ignore unused arguments
mkdirs

Creates a directory including any necessary but nonexistent parent directories