Learn R Programming

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

BBmisc (version 1.12)

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

10,714

Version

1.12

License

BSD_2_clause + file LICENSE

Issues

Pull Requests

Stars

Forks

Maintainer

Bernd Bischl

Last Published

March 10th, 2022

Functions in BBmisc (1.12)

addClasses

A wrapper to add to the class attribute.
catf

Wrapper for cat and sprintf.
asMatrixCols

Extracts a named element from a list of lists.
cFactor

Combine multiple factors and return a factor.
binPack

Simple bin packing.
checkArg

Check for a function argument.
%btwn%

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

Parses ... arguments to a named list.
capitalizeStrings

Capitalize strings in a vector
asQuoted

Converts a string into a quoted expression.
computeMode

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

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

Deprecated function. Do not use!
clipString

Shortens strings to a given length.
getMaxIndexOfRows

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

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

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

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

Check that a list contains only elements of a required type.
collapse

Collapse vector to string.
convertListOfRowsToDataFrame

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

Collapse vector to string.
getUsedFactorLevels

Determines used factor levels.
convertInteger

Conversion for single integer.
itostr

Convert Integers to Strings
do.call2

Execute a function call similar to do.call.
convertMatrixType

Converts storage type of a matrix.
convertIntegers

Conversion for integer vector.
explode

Split up a string into substrings.
chunk

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

Check if given object has certain attributes.
ensureVector

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

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

Drop named elements of an object.
extractSubList

Extracts a named element from a list of lists.
lib

A wrapper for library.
getRelativePath

Construct a path relative to another
getClass1

Wrapper for class(x)[1].
isEmptyDirectory

Is one / are several directories empty?
makeFileCache

A caching wrapper around load2.
getFirst

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

Wrapper for message and sprintf.
normalize

Normalizes numeric data to a given scale.
getOperatingSystem

Functions to determine the operating system.
filterNull

Filter a list for NULL values
getUnixTime

Current time in seconds.
getAttributeNames

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

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

Conditional checking for expensive examples.
isProperlyNamed

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

Split a path into components
makeProgressBar

Create a progress bar with estimated time.
seq_row

Generate sequences along rows or cols.
makeS3Obj

Simple constructor for S3 objects based on lists.
isDirectory

Is one / are several files a directory?
optimizeSubInts

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

Initialize data.frame in a convenient way.
getMaxIndex

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

Split seconds into handy chunks of time.
isScalarNA

Checks whether an object is a scalar NA value.
load2

Load RData file and return objects in it.
isFALSE

A wrapper for identical(x, FALSE).
isScalarValue

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

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

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

Check subset relation on two vectors.
mapValues

Replace values in atomic vectors
printStrToChar

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

Simple logger which outputs to a file.
rowLapply

Apply function to rows of a data frame.
stopf

Wrapper for stop and sprintf.
printHead

More meaningful head(df) output.
strrepeat

Repeat and join a string
printToChar

Prints object to a string / character vector.
setValue

Set a list element to a new value.
which.first

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

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

Save multiple objects to a file.
vlapply

Apply a function with a predefined return value
warningf

Wrapper for warning and sprintf.
is.error

Is return value of try an exception?
isValidName

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

Simply a negated in operator.
system3

Wrapper for system2 with better return type and errorhandling.
setClasses

A wrapper for class(x) = classes.
setAttribute

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

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

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

Replacement for names which always returns a vector.
isSuperset

Check superset relation on two vectors.
rangeVal

Calculate range statistic.
toRangeStr

Convert a numerical vector into a range string.
suppressAll

Suppresses all output except for errors.
symdiff

Calculates symmetric set difference between two sets.
requirePackages

Require some packages.