Learn R Programming

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

R.utils (version 1.19.3)

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.19.3

License

LGPL (>= 2.1)

Maintainer

Henrik Bengtsson

Last Published

December 22nd, 2012

Functions in R.utils (1.19.3)

capture.Verbose

Captures output of a function
cat.Verbose

Concatenates and prints objects if above threshold
extract.array

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

The Options class
LComments

The LComments class
convertComment.VComments

Converts a verbose comment to R code
MultiVerbose

A Verbose class ignoring everything
System

Static class to query information about the system
getIntegers.Arguments

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

Gets the processed character string
cleanup.FileProgressBar

Removes the progress file for a file progress bar
getBarString.ProgressBar

Gets the progress bar string to be displayed
detachPackage

Detaches a packages by name
getInstanceOf.Arguments

Gets an instance of the object that is of a particular class
getDoubles.Arguments

Coerces to a double vector and validates
getBuiltinPid.GString

Gets the process id of the current R session
R.utils-package

Package R.utils
as.character.Verbose

Returns a character string version of this object
Settings

Class for applicational settings
asByte.Java

Converts a numeric to a Java byte
createWindowsShortcut

Creates a Microsoft Windows Shortcut (.lnk file)
exit.Verbose

Writes a message and unindents the following output
moveInSearchPath

Moves a environment in the search path to another position
flush.TextStatusBar

Flushes the output
isOn.NullVerbose

Checks if the output is on
createLink

Creates a link to a file or a directory
countLines

Counts the number of lines in a text file
convertComment.SmartComments

Converts a single smart comment to R code
getMessage.TimeoutException

Gets the message of the exception
as.list.Options

Gets a list representation of the options
getOption.Options

Gets an option
writeDataFrame.data.frame

Writes a data.frame to tabular text file
onGarbageCollect

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

Gets the current R version
printf.Verbose

Formats and prints object if above threshold
printf

C-style formatted output
evalWithTimeout

Evaluate an R expression and interrupts it if it takes too long
asInt.Java

Converts an numeric to a Java integer
getLogicals.Arguments

Coerces to a logical vector and validates
off.Verbose

Turn off the output
patchCode

Patches installed and loaded packages and more
getHostname.System

Retrieves the computer name of the current host
hpaste

Concatenating vectors into human-readable strings
intervalsToSeq.matrix

Generates a vector of indices from a matrix of intervals
isDirectory

Checks if the file specification is a directory
asLong.Java

Converts a numeric to a Java long
capitalize

Capitalizes/decapitalizes each character string in a vector
getReadablePathnames.Arguments

Gets a readable pathname
unwrap.array

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

Reads one or more Rd help files in a certain format
getTimestampFormat.Verbose

Gets the default timestamp format
downloadFile.character

Downloads a file
getAbsolutePath

Gets the absolute pathname string
renameFile

Renames a file safely
isAbsolutePath

Checks if this pathname is absolute
getNumerics.Arguments

Coerces to a numeric vector and validates
addFinalizerToLast

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

Prints objects if above threshold
isDone.ProgressBar

Checks if progress bar is completed
commandArgs

Extract Command Line Arguments
isScalar.Assert

Static method asserting thatan object is a single value
bunzip2

Bunzip a file
TimeoutException

TimeoutException represents timeout errors
setProgress.ProgressBar

Sets current progress
check.Assert

Static method asserting that a generic condition is true
NullVerbose

A Verbose class ignoring everything
saveAnywhere.Settings

Saves settings to file
isEof.connection

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

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

Converts vector indices to array indices
header.Verbose

Writes a header
equals.Options

Checks if this object is equal to another Options object
listDirectory

Gets the file names in the directory
findSourceTraceback

Finds all 'srcfile' objects generated by source() in all call frames
getBuiltinRhome.GString

Gets the path where R is installed
mkdirs

Creates a directory including any necessary but nonexistent parent directories
getEnvironment.Arguments

Gets an existing environment
lastModified

Gets the time when the file was last modified
isPackageInstalled

Checks if a package is installed or not
getVector.Arguments

Validates a vector
getRaw.GString

Gets the unprocessed GString
setTimestampFormat.Verbose

Sets the default timestamp format
fileAccess

Checks the permission of a file or a directory
callHooks.function

Call hook functions
pushTemporaryFile

Appends a temporary suffix to the pathname
isUrl

Checks if one or several pathnames is URLs
hasOption.Options

Checks if an option exists
getBuiltinOs.GString

Gets the operating system of the running machine
mapToIntervals.numeric

Maps values to intervals
readWindowsShellLink

Reads a Microsoft Windows Shortcut (.lnk file)
onSessionExit

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

Writes a newline
getCharacters.Arguments

Coerces to a character vector and validates
setOption.Options

Sets an option
isOn.Verbose

Checks if the output is on
getLeaves.Options

Gets all (non-list) options in a flat list
insert

Insert values to a vector at certain positions
sourceTo

Parses and evaluates code from a file or a connection
setStepLength.ProgressBar

Sets default step length
names.Options

Gets the full pathname of all (non-list) options
getUsername.System

Retrieves the name of the user running R
getVariableValue.GString

Gets a variable value given a name and attributes
sourceDirectory

Sources files recursively to either local or global environment
parse.GString

Parses a GString
inAnyInterval.numeric

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

Drops a backup suffix from the backup pathname
ruler.Verbose

Writes a ruler
removeDirectory

Removes a directory
pushState.Verbose

Pushes the current indentation state of the Verbose object
loadToEnv

Method to load objects to a new environment
setLabels.TextStatusBar

Sets new values of given labels
getThreshold.Verbose

Gets current verbose threshold
isVisible.Verbose

Checks if a certain verbose level will be shown or not
parseDebian.System

Parses a string, file or connection for Debian formatted parameters
increase.ProgressBar

Increases (steps) progress bar
writeUTF.Java

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

Launches another R process from within R
setThreshold.Verbose

Sets verbose threshold
as.character.ProgressBar

Gets a string description of the progress bar
reset.ProgressBar

Reset progress bar
getRelativePath

Gets the relative pathname relative to a directory
on.Verbose

Turn on the output
reassignInPackage

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

Evaluates an expression and captures the code and/or the output
compile.SmartComments

Preprocess a vector of code lines
touchFile

Updates the timestamp of a file
wrap.array

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

A progress bar that sets the size of a file accordingly
findGraphicsDevice.System

Searches for a working PNG device
isSingle

Identifies all entries that exists exactly ones
Non-documented objects

Non-documented objects
swapXY.density

Swaps x and y coordinates of a density object
dataFrame

Allocates a data frame with given column classes
getBuiltinHostname.GString

Gets the hostname of the system running R
str.Options

Prints the structure of the options
GString

Character string with advanced substitutions
createFileAtomically

Creates a file atomically
loadAnywhere.Settings

Loads settings from file
isMatrix.Assert

Static method asserting thatan object is a matrix
dimNA< -

Sets the dimension of an object with the option to infer one dimension autmatically
readInt.Java

Reads a Java formatted int (32 bits) from a connection
validate.VComments

Validates the compiled lines
update.FileProgressBar

Updates file progress bar
saveObject

Saves an object to a file or a connection
env

Creates a new environment, evaluates an expression therein, and returns the environment
equals.Verbose

Checks if this object is equal to another
setDefaultLevel.Verbose

Sets the current default verbose level
writeShort.Java

Writes a short (16 bits) to a connection in Java format
update.TextStatusBar

Updates the status bar (visually)
writeInt.Java

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

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

All output methods
getBuiltinTime.GString

Gets the current time
colClasses

Creates a vector of column classes used for tabular reading
copyDirectory

Copies a directory
getBuiltinDate.GString

Gets the current date
getLabel.TextStatusBar

Gets the current value of a label
getParent

Gets the string of the parent specified by this pathname
print.GString

Prints the processed GString
setOption

Sets a option in R
getIndices.Arguments

Coerces to a integer vector and validates
getVerbose.Arguments

Coerces to Verbose object
enter.Verbose

Writes a message and indents the following output
getRegularExpression.Arguments

Gets a valid regular expression pattern
validate.SmartComments

Validates the compiled lines
inherits.Assert

Static method asserting that an object inherits from of a certain class
isVisible.NullVerbose

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

Writes a timestamp
gzip

Gzip/Gunzip a file
ProgressBar

Provides text based counting progress bar
isOpen.character

Checks if there is an open connection to a file
isFile

Checks if the file specification is a file
as.logical.Verbose

Gets a logical value of this object
asShort.Java

Converts a numeric to a Java short
less.Verbose

Creates a cloned instance with a higher threshold
popMessage.TextStatusBar

Adds a message above the status bar
pushBackupFile

Appends a backup suffix to the pathname
currentTimeMillis.System

Get the current time in milliseconds
nbrOfOptions.Options

Gets the number of options set
parse.SmartComments

Parses one single smart comment
warnings.Verbose

Outputs any warnings recorded
doCall

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

Assigns an objects elements locally
reset.SmartComments

Resets a SmartComments compiler
queryRCmdCheck

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

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

Sample values from a set of elements
setValue.ProgressBar

Sets current value
readTableIndex

Reads a single column from file in table format
draw.density

Draws a density curve
Java

Static class for Java related methods
updateLabels.TextStatusBar

Sets the new values of given labels and updates the status bar
setTicks.ProgressBar

Sets values for which ticks should be visible
Assert

The Assert class
evaluate.Verbose

Evaluates a function and prints its results if above threshold
seqToIntervals

Gets all contigous intervals of a vector of indices
getBuiltinDatetime.GString

Gets the current date and time
summary.Verbose

Generates a summary of an object if above threshold
setMaxValue.ProgressBar

Sets maximum value
Verbose

Class to writing verbose messages to a connection or file
str.Verbose

Prints the structure of an object if above threshold
as.character.binmode

Converts a binary/octal/hexadecimal number into a string
getReadablePathname.Arguments

Gets a readable pathname
findFiles

Finds one or several files in multiple directories
getLoadedPathname.Settings

Gets the pathname of the settings file loaded
writeBinFragments

Writes binary data to disjoint sections of a connection or a file
mergeIntervals.numeric

Merges intervals
subplots

Creates a grid of subplots
isZero

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

Converts a pathname into a URL
isPackageLoaded

Checks if a package is loaded or not
as.list.MultiVerbose

Gets a list of Verbose objects
isModified.Settings

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

Searches for the settings file in one or several directories
isReplicated

Identifies all entries with replicated values
loadObject

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

Writes one or several empty lines
promptAndSave.Settings

Prompt user to save modified settings
readWindowsShortcut

Reads a Microsoft Windows Shortcut (.lnk file)
toCamelCase

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

Reads a file in table format
setLabel.TextStatusBar

Sets the value of a label
Arguments

Static class to validate and process arguments
as.character.Options

Returns a character string version of this object
VComments

The VComments class
finalizeSession

Function to call for finalizing the R session
getFilename.Arguments

Gets and validates a filename
hasUrlProtocol

Checks if one or several pathnames has a URL protocol
openBrowser.System

Opens an HTML document using the OS default HTML browser
reset.VComments

Resets a VComments compiler
update.ProgressBar

Updates progress bar
writeRaw.Verbose

Writes objects if above threshold
stext

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

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

Call hook functions by hook name
isVector.Assert

Static method asserting thatan object is a vector
readShort.Java

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

Drops a temporary suffix from the temporary pathname
writeByte.Java

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

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

Abstract class SmartComments
as.double.Verbose

Gets a numeric value of this object
copyFile

Copies a file safely
findGhostscript.System

Searches for the ghostview binary on the current system
getBuiltinUsername.GString

Gets the username of the user running R
timestampOn.Verbose

Turns automatic timestamping on and off
getWritablePathname.Arguments

Gets a writable pathname
intToBin

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

Creates a cloned instance with a lower threshold
readByte.Java

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

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

Resets recorded warnings
splitByPattern

Splits a single character string by pattern
writeRaw.MultiVerbose

Writes to each of the Verbose objects
whichVector.logical

Identifies TRUE elements in a logical vector