Package 'BASIX'

Title: An Efficient C/C++ Toolset for R
Description: Accelerated computation for some basic R functions. Compatibility updates by Renova.
Authors: Bastian Pfeifer [aut, cre]
Maintainer: Bastian Pfeifer <[email protected]>
License: GPL-2
Version: 1.2.9001
Built: 2026-11-13 18:01:15 UTC
Source: https://github.com/renova-r/BASIX

Help Index


Combine-Apply

Description

This function applies a specific calculation, defined by the user, to all pairs of entries of a vector.

Usage

BASIX.combnapply(vec, mode='*')

Arguments

vec

vector

mode

*,-,/,+ or ==

Details

BASIX.combnapply returns values for each pair-combination.

Author(s)

Bastian Pfeifer

Examples

vec  <- c(1,3,5,7,9,10)
BASIX.combnapply(vec)

Test if two vectors are equal

Description

This function checks if two vectors are equal, by comparing each cell and quits when the first mismatch occurs.

Usage

BASIX.equal(a,b)

Arguments

a

first vector

b

second vector

Details

Native R functions compare every entry of the entired vectors,

The R solution would be:

all(a==b)

The function can be applied to numeric as well as character vectors

Author(s)

Bastian Pfeifer

Examples

a <- 1:10
b <- a
b[2] <- 9
BASIX.equal(a,b)

Positions of elements in a defined region

Description

This function returns the positions of elements which are in a defined region.

Usage

BASIX.find.interval(vec,from,to,start=1)

Arguments

vec

base vector

from

left side

to

right side

start

the start position

Details

The function returns the position of the elements in vector vec,
which are in a specific interval, defined by from and to,
starting from position start.

The native R solution would be:

X <- (vec >= from) & (vec <= to)
ids <- which(X)

or the function findInterval(), which is just a little bit slower than BASIX.interval

Author(s)

Bastian Pfeifer

Examples

vec  <- c(1,3,5,7,9,10)
from <- 5
to   <- 8
BASIX.find.interval(vec,from,to,1)

Value Matching for sorted vectors.

Description

The function returns a vector of the positions of (first) matches of its first argument in its second.

Usage

BASIX.match(elements,vec)

Arguments

elements

values to be matched

vec

the values to be matched against

Details

BASIX.match stops at the first match and continues with the next element of elements starting from the match position in vec.

The native R solution would be:

match(elements,vec)

Author(s)

Bastian Pfeifer

Examples

elements <- c(1,2,10)
vec      <- c(2,3,4,10,11)

BASIX.match(elements,vec)

Count Tabulation of Matrices

Description

BASIX.table computes the counts of unique rows of a matrix.

Usage

BASIX.table(matrix)

Arguments

matrix

a matrix

Details

This function can be applied to numeric as well as character matrices.

Author(s)

Bastian Pfeifer

Examples

mat <- matrix(0,3,3)
mat[1,1] <- 1

BASIX.table(mat)

Extract unique rows of a matrix

Description

BASIX.unique returns a matrix with duplicate rows removed. The unique rows ids will be saved as rownames.

Usage

BASIX.unique(matrix)

Arguments

matrix

a matrix

Details

BASIX.unique is a version of unique specialized on matrices.

The native R solution would be:
unique(matrix)

This function can be applied to numeric as well as character vectors.

Author(s)

Bastian Pfeifer

Examples

mat <- matrix(0,3,3)
mat[1,1] <- 1

BASIX.unique(mat)