Learn R Programming

BBmisc (version 1.13)

Miscellaneous Helper Functions for B. Bischl

Description

Miscellaneous helper functions for and from B. Bischl and some other guys, mainly for package development.

Copy Link

Version

Install

install.packages('BBmisc')

Monthly Downloads

11,303

Version

1.13

License

BSD_2_clause + file LICENSE

Issues

Pull Requests

Stars

Forks

Maintainer

Last Published

September 29th, 2022

Functions in BBmisc (1.13)

checkArg

Check for a function argument.
capitalizeStrings

Capitalize strings in a vector
catf

Wrapper for cat and sprintf.
cFactor

Combine multiple factors and return a factor.
binPack

Simple bin packing.
addClasses

A wrapper to add to the class attribute.
argsAsNamedList

Parses ... arguments to a named list.
checkListElementClass

Check that a list contains only elements of a required type.
%btwn%

Check if some values are covered by the range of the values in a second vector.
asMatrixCols

Extracts a named element from a list of lists.
chunk

Chunk elements of vectors into blocks of nearly equal size.
coalesce

Returns first non-missing, non-null argument.
computeMode

Compute statistical mode of a vector (value that occurs most frequently).
convertDataFrameCols

Converts columns in a data frame to characters, factors or numerics.
collapse

Collapse vector to string.
collapsef

Collapse vector to string.
clipString

Shortens strings to a given length.
dropNamed

Drop named elements of an object.
do.call2

Execute a function call similar to do.call.
dapply

Call lapply on an object and return a data.frame.
ensureVector

Blow up single scalars / objects to vectors / list by replication.
deprecated

Deprecated function. Do not use!
explode

Split up a string into substrings.
convertInteger

Conversion for single integer.
asQuoted

Converts a string into a quoted expression.
getOperatingSystem

Functions to determine the operating system.
getClass1

Wrapper for class(x)[1].
getMaxIndexOfRows

Find row- or columnwise the index of the maximal / minimal element in a matrix.
getAttributeNames

Helper function for determining the vector of attribute names of a given object.
getFirst

Get the first/last element of a list/vector.
convertToShortString

Converts any R object to a descriptive string so it can be used in messages.
convertRowsToList

Convert rows (columns) of data.frame or matrix to lists.
getRelativePath

Construct a path relative to another
getUnixTime

Current time in seconds.
getUsedFactorLevels

Determines used factor levels.
getMaxIndex

Return index of maximal/minimal/best element in numerical vector.
isDirectory

Is one / are several files a directory?
hasAttributes

Check if given object has certain attributes.
isFALSE

A wrapper for identical(x, FALSE).
isExpensiveExampleOk

Conditional checking for expensive examples.
convertMatrixType

Converts storage type of a matrix.
convertIntegers

Conversion for integer vector.
extractSubList

Extracts a named element from a list of lists.
convertListOfRowsToDataFrame

Convert a list of row-vector of equal structure to a data.frame.
isEmptyDirectory

Is one / are several directories empty?
isSubset

Check subset relation on two vectors.
isScalarValue

Is given argument an atomic vector or factor of length 1?
makeFileCache

A caching wrapper around load2.
makeDataFrame

Initialize data.frame in a convenient way.
isProperlyNamed

Are all elements of a list / vector uniquely named?
insert

Insert elements from one list/vector into another list/vector.
filterNull

Filter a list for NULL values
itostr

Convert Integers to Strings
isScalarNA

Checks whether an object is a scalar NA value.
makeProgressBar

Create a progress bar with estimated time.
makeS3Obj

Simple constructor for S3 objects based on lists.
lsort

A wrapper for sort to sort using the “C” collating rules.
%nin%

Simply a negated in operator.
names2

Replacement for names which always returns a vector.
is.error

Is return value of try an exception?
lib

A wrapper for library.
isSuperset

Check superset relation on two vectors.
load2

Load RData file and return objects in it.
isValidName

Can some strings be used for column or list element names without problems?
printStrToChar

Print str(x) of an object to a string / character vector.
messagef

Wrapper for message and sprintf.
namedList

Create named list, possibly initialized with a certain element.
rangeVal

Calculate range statistic.
setClasses

A wrapper for class(x) = classes.
printToChar

Prints object to a string / character vector.
setRowNames

Wrapper for rownames(x) = y, colnames(x) = y.
symdiff

Calculates symmetric set difference between two sets.
save2

Save multiple objects to a file.
suppressAll

Suppresses all output except for errors.
rowLapply

Apply function to rows of a data frame.
seq_row

Generate sequences along rows or cols.
optimizeSubInts

Naive multi-start version of optimize for global optimization.
normalize

Normalizes numeric data to a given scale.
requirePackages

Require some packages.
splitPath

Split a path into components
vlapply

Apply a function with a predefined return value
system3

Wrapper for system2 with better return type and errorhandling.
toRangeStr

Convert a numerical vector into a range string.
warningf

Wrapper for warning and sprintf.
splitTime

Split seconds into handy chunks of time.
which.first

Find the index of first/last TRUE value in a logical vector.
pause

Pause in interactive mode and continue on <Enter>.
mapValues

Replace values in atomic vectors
printHead

More meaningful head(df) output.
strrepeat

Repeat and join a string
makeSimpleFileLogger

Simple logger which outputs to a file.
stopf

Wrapper for stop and sprintf.
setAttribute

A wrapper for attr(x, which) = y.
sortByCol

Sort the rows of a data.frame according to one or more columns.
setValue

Set a list element to a new value.