Learn R Programming

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

R.utils (version 1.19.5)

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

License

LGPL (>= 2.1)

Maintainer

Henrik Bengtsson

Last Published

January 17th, 2013

Functions in R.utils (1.19.5)

R.utils-package

Package R.utils
attachLocally.list

Assigns an objects elements locally
getAbsolutePath

Gets the absolute pathname string
getDoubles.Arguments

Coerces to a double vector and validates
insert

Insert values to a vector at certain positions
names.Options

Gets the full pathname of all (non-list) options
off.Verbose

Turn off the output
saveAnywhere.Settings

Saves settings to file
TimeoutException

TimeoutException represents timeout errors
ProgressBar

Provides text based counting progress bar
check.Assert

Static method asserting that a generic condition is true
asShort.Java

Converts a numeric to a Java short
asLong.Java

Converts a numeric to a Java long
Java

Static class for Java related methods
countLines

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

Converts a verbose comment to R code
findGhostscript.System

Searches for the ghostview binary on the current system
hasOption.Options

Checks if an option exists
getBuiltinHostname.GString

Gets the hostname of the system running R
dimNA< -

Sets the dimension of an object with the option to infer one dimension autmatically
getBarString.ProgressBar

Gets the progress bar string to be displayed
getThreshold.Verbose

Gets current verbose threshold
isVector.Assert

Static method asserting thatan object is a vector
Arguments

Static class to validate and process arguments
Options

The Options class
as.double.Verbose

Gets a numeric value of this object
isDirectory

Checks if the file specification is a directory
Non-documented objects

Non-documented objects
getRelativePath

Gets the relative pathname relative to a directory
patchCode

Patches installed and loaded packages and more
setDefaultLevel.Verbose

Sets the current default verbose level
isAbsolutePath

Checks if this pathname is absolute
Verbose

Class to writing verbose messages to a connection or file
colClasses

Creates a vector of column classes used for tabular reading
popTemporaryFile

Drops a temporary suffix from the temporary pathname
isSingle

Identifies all entries that exists exactly ones
findFiles

Finds one or several files in multiple directories
isPackageLoaded

Checks if a package is loaded or not
setLabels.TextStatusBar

Sets new values of given labels
convertComment.SmartComments

Converts a single smart comment to R code
createWindowsShortcut

Creates a Microsoft Windows Shortcut (.lnk file)
readRdHelp

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

Checks if a value is (close to) zero or not
setStepLength.ProgressBar

Sets default step length
update.TextStatusBar

Updates the status bar (visually)
createLink

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

Creates a cloned instance with a higher threshold
setMaxValue.ProgressBar

Sets maximum value
newline.Verbose

Writes one or several empty lines
summary.Verbose

Generates a summary of an object if above threshold
callHooks

Call hook functions by hook name
flush.TextStatusBar

Flushes the output
timestamp.Verbose

Writes a timestamp
findSettings.Settings

Searches for the settings file in one or several directories
env

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

Creates a grid of subplots
findSourceTraceback

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

Updates the timestamp of a file
getFilename.Arguments

Gets and validates a filename
getBuiltinPid.GString

Gets the process id of the current R session
openBrowser.System

Opens an HTML document using the OS default HTML browser
nbrOfOptions.Options

Gets the number of options set
detachPackage

Detaches a packages by name
getCharacters.Arguments

Coerces to a character vector and validates
isDone.ProgressBar

Checks if progress bar is completed
printf.Verbose

Formats and prints object if above threshold
getIndices.Arguments

Coerces to a integer vector and validates
getReadablePathnames.Arguments

Gets a readable pathname
getLoadedPathname.Settings

Gets the pathname of the settings file loaded
getVariableValue.GString

Gets a variable value given a name and attributes
queryRCmdCheck

Gets the on R CMD check if the current R session was launched by it
getVerbose.Arguments

Coerces to Verbose object
header.Verbose

Writes a header
readByte.Java

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

Static method asserting that an object inherits from of a certain class
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
commandArgs

Extract Command Line Arguments
readWindowsShortcut

Reads a Microsoft Windows Shortcut (.lnk file)
lastModified

Gets the time when the file was last modified
isUrl

Checks if one or several pathnames is URLs
parse.GString

Parses a GString
NullVerbose

A Verbose class ignoring everything
LComments

The LComments class
GString

Character string with advanced substitutions
loadToEnv

Method to load objects to a new environment
setOption.Options

Sets an option
listDirectory

Gets the file names in the directory
print.GString

Prints the processed GString
readTableIndex

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

Concatenates and prints objects if above threshold
getLabel.TextStatusBar

Gets the current value of a label
currentTimeMillis.System

Get the current time in milliseconds
bunzip2

Bunzip a file
as.character.Options

Returns a character string version of this object
TextStatusBar

A status bar at the R prompt that can be updated
timestampOn.Verbose

Turns automatic timestamping on and off
addFinalizerToLast

Modifies .Last() to call 'finalizeSession()
getBuiltinDatetime.GString

Gets the current date and time
enter.Verbose

Writes a message and indents the following output
printf

C-style formatted output
as.list.MultiVerbose

Gets a list of Verbose objects
validate.SmartComments

Validates the compiled lines
readInt.Java

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

Gets the string of the parent specified by this pathname
isOpen.character

Checks if there is an open connection to a file
pushBackupFile

Appends a backup suffix to the pathname
increase.ProgressBar

Increases (steps) progress bar
evalCapture

Evaluates an expression and captures the code and/or the output
saveObject

Saves an object to a file or a connection
callHooks.function

Call hook functions
readWindowsShellLink

Reads a Microsoft Windows Shortcut (.lnk file)
copyFile

Copies a file safely
copyDirectory

Copies a directory
reassignInPackage

Re-assigns a new value to an existing object in a loaded package
getInstanceOf.Arguments

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

Creates a directory including any necessary but nonexistent parent directories
readTable

Reads a file in table format
isFile

Checks if the file specification is a file
gzip

Gzip/Gunzip a file
FileProgressBar

A progress bar that sets the size of a file accordingly
isMatrix.Assert

Static method asserting thatan object is a matrix
as.character.GString

Gets the processed character string
promptAndSave.Settings

Prompt user to save modified settings
createFileAtomically

Creates a file atomically
more.Verbose

Creates a cloned instance with a lower threshold
isOn.NullVerbose

Checks if the output is on
isPackageInstalled

Checks if a package is installed or not
seqToIntervals

Gets all contigous intervals of a vector of indices
sourceDirectory

Sources files recursively to either local or global environment
filePath

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

Pushes the current indentation state of the Verbose object
getBuiltinRhome.GString

Gets the path where R is installed
fileAccess

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

Writes a ruler
getBuiltinOs.GString

Gets the operating system of the running machine
getIntegers.Arguments

Coerces to a integer vector and validates
writeUTF.Java

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

Drops a backup suffix from the backup pathname
as.list.Options

Gets a list representation of the options
isScalar.Assert

Static method asserting thatan object is a single value
setOption

Sets a option in R
renameFile

Renames a file safely
parse.SmartComments

Parses one single smart comment
wrap.array

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

Resets recorded warnings
setValue.ProgressBar

Sets current value
getBuiltinUsername.GString

Gets the username of the user running R
asInt.Java

Converts an numeric to a Java integer
getBuiltinRversion.GString

Gets the current R version
setTicks.ProgressBar

Sets values for which ticks should be visible
displayCode

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

Evaluate an R expression and interrupts it if it takes too long
newline.TextStatusBar

Writes a newline
writeBinFragments

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

Converts a string of words into a merged camel-cased word
getMessage.TimeoutException

Gets the message of the exception
print.Verbose

Prints objects if above threshold
Assert

The Assert class
as.logical.Verbose

Gets a logical value of this object
str.Verbose

Prints the structure of an object if above threshold
unwrap.array

Unwrap an array, matrix or a vector to an array of more dimensions
parseDebian.System

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

Reads binary data from disjoint sections of a connection or a file
isModified.Settings

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

Removes a directory
whichVector.logical

Identifies TRUE elements in a logical vector
Settings

Class for applicational settings
resample

Sample values from a set of elements
finalizeSession

Function to call for finalizing the R session
dataFrame

Allocates a data frame with given column classes
doCall

Executes a function call with option to ignore unused arguments
intervalsToSeq.matrix

Generates a vector of indices from a matrix of intervals
seqToHumanReadable

Gets a short human readable string representation of an vector of indices
getLogicals.Arguments

Coerces to a logical vector and validates
sourceTo

Parses and evaluates code from a file or a connection
as.character.ProgressBar

Gets a string description of the progress bar
swapXY.density

Swaps x and y coordinates of a density object
setLabel.TextStatusBar

Sets the value of a label
moveInSearchPath

Moves a environment in the search path to another position
splitByPattern

Splits a single character string by pattern
validate.VComments

Validates the compiled lines
updateLabels.TextStatusBar

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

Sets the default timestamp format
hpaste

Concatenating vectors into human-readable strings
writeRaw.MultiVerbose

Writes to each of the Verbose objects
mergeIntervals.numeric

Merges intervals
onSessionExit

Registers a function to be called when the R session finishes
getHostname.System

Retrieves the computer name of the current host
popMessage.TextStatusBar

Adds a message above the status bar
reset.ProgressBar

Reset progress bar
getRaw.GString

Gets the unprocessed GString
update.ProgressBar

Updates progress bar
draw.density

Draws a density curve
getOption.Options

Gets an option
inAnyInterval.numeric

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

Checks if one or several pathnames has a URL protocol
onGarbageCollect

Registers a function to be called when the R garbage collector is (detected to be) running
as.character.binmode

Converts a binary/octal/hexadecimal number into a string
extract.array

Extract a subset of an array, matrix or a vector with unknown dimensions
cleanup.FileProgressBar

Removes the progress file for a file progress bar
getEnvironment.Arguments

Gets an existing environment
writeInt.Java

Writes a integer (32 bits) to a connection in Java format
getVector.Arguments

Validates a vector
mapToIntervals.numeric

Maps values to intervals
loadAnywhere.Settings

Loads settings from file
str.Options

Prints the structure of the options
MultiVerbose

A Verbose class ignoring everything
compile.SmartComments

Preprocess a vector of code lines
downloadFile.character

Downloads a file
exit.Verbose

Writes a message and unindents the following output
intToBin

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

Identifies all entries with replicated values
toUrl

Converts a pathname into a URL
writeRaw.Verbose

Writes objects if above threshold
equals.Verbose

Checks if this object is equal to another
System

Static class to query information about the system
equals.Options

Checks if this object is equal to another Options object
loadObject

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

Turn on the output
pushTemporaryFile

Appends a temporary suffix to the pathname
readShort.Java

Reads a Java formatted short (16 bits) from a connection
reset.SmartComments

Resets a SmartComments compiler
stext

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

Launches another R process from within R
update.FileProgressBar

Updates file progress bar
SmartComments

Abstract class SmartComments
VComments

The VComments class
arrayIndex

Converts vector indices to array indices
capitalize

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

Captures output of a function
findGraphicsDevice.System

Searches for a working PNG device
getNumerics.Arguments

Coerces to a numeric vector and validates
getTimestampFormat.Verbose

Gets the default timestamp format
getWritablePathname.Arguments

Gets a writable pathname
reset.VComments

Resets a VComments compiler
as.character.Verbose

Returns a character string version of this object
asByte.Java

Converts a numeric to a Java byte
evaluate.Verbose

Evaluates a function and prints its results if above threshold
getBuiltinDate.GString

Gets the current date
setProgress.ProgressBar

Sets current progress
setThreshold.Verbose

Sets verbose threshold
writeByte.Java

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

All output methods
getBuiltinTime.GString

Gets the current time
writeShort.Java

Writes a short (16 bits) to a connection in Java format
getLeaves.Options

Gets all (non-list) options in a flat list
getReadablePathname.Arguments

Gets a readable pathname
getRegularExpression.Arguments

Gets a valid regular expression pattern
getUsername.System

Retrieves the name of the user running R
isOn.Verbose

Checks if the output is on
isVisible.Verbose

Checks if a certain verbose level will be shown or not
readUTF.Java

Reads a Java (UTF-8) formatted string from a connection
writeDataFrame.data.frame

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

Outputs any warnings recorded