Learn R Programming

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

matsbyname

The R package matsbyname enables matrix mathematics wherein operations are performed “by name” and row and column types are allowed.

Installation

You can install matsbyname from CRAN with:

install.packages("matsbyname")

You can install a recent development version of matsbyname from github with:

# install devtools if not already installed
# install.packages("devtools")
devtools::install_github("MatthewHeun/matsbyname")
# To build vignettes locally, use
devtools::install_github("MatthewHeun/matsbyname", build_vignettes = TRUE)

History

The functions in this package were used in Heun et al. (2018).

More Information

Find more information, including vignettes and function documentation, at https://MatthewHeun.github.io/matsbyname/.

References

Heun, Matthew Kuperus, Anne Owen, and Paul E. Brockway. 2018. “A Physical Supply-Use Table Framework for Energy Analysis on the Energy Conversion Chain.” Applied Energy 226 (September): 1134–62. https://doi.org/10.1016/j.apenergy.2018.05.109.

Copy Link

Version

Install

install.packages('matsbyname')

Monthly Downloads

560

Version

0.6.3

License

MIT + file LICENSE

Issues

Pull Requests

Stars

Forks

Maintainer

Matthew Heun

Last Published

May 22nd, 2023

Functions in matsbyname (0.6.3)

Iminus_byname

Subtract a matrix with named rows and columns from a suitably named and sized identity matrix (I)
aggregate_pieces_byname

Aggregate a matrix by pieces of row and/or column names
and_byname

And "by name"
Matrix

Create a Matrix amenable to use in the matsbyname package
all_byname

Are all matrix elements TRUE?
any_byname

Are any matrix elements TRUE?
aggregate_byname

Aggregate rows and columns in a matrix
aggregation_map_helpers

Aggregation map conversions
abs_byname

Absolute value of matrix elements
aggregate_to_pref_suff_byname

Aggregate a matrix to prefixes or suffixes of row and/or column names
binaryapply_byname

Apply a binary function "by name"
coltype

Column type
count_vals_byname

Count the number of matrix entries that meet a criterion
complete_rows_cols

Complete rows and columns in one matrix relative to another
count_vals_incols_byname

Count the number of matrix entries in columns that meet a criterion
colsums_byname

Column sums, sorted by name
compare_byname

Compare matrix entries to a value
colprods_byname

Column products, sorted by name
complete_and_sort

Complete matrices relative to one another and sort into same row, column order
clean_byname

Clean (delete) rows or columns of matrices that contain exclusively clean_value
cumsum_byname

Cumulative sum that respects row and column names
count_vals_inrows_byname

Count the number of matrix entries in rows that meet a criterion
eigenvalues_byname

Calculate eigenvalues of a matrix
difference_byname

Name-wise subtraction of matrices
create_colvec_byname

Create column vectors from data
getcolnames_byname

Gets column names
fractionize_byname

Compute fractions of matrix entries
cumapply_byname

Apply a function cumulatively to a list of matrices or numbers
cumprod_byname

Cumulative element-product that respects row and column names
create_rowvec_byname

Create row vectors from data
create_matrix_byname

Create a "byname" matrix from a vector
.data

Data pronoun
eigenvectors_byname

Calculate eigenvectors of a matrix
elementapply_byname

Apply a function to an element of a matrix specified by rows and columns
getrownames_byname

Gets row names
list_of_rows_or_cols

Named list of rows or columns of matrices
geometricmean_byname

Name- and element-wise geometric mean of two matrices.
kvec_from_template_byname

Create a constant vector from matrix a
is.Matrix

Is an object a Matrix?
getzerorowcolnames_byname

Names of zero rows and columns
invert_byname

Invert a matrix
hadamardproduct_byname

Name-wise matrix Hadamard multiplication
hatize_byname

Creates a diagonal "hat" matrix from a vector
hatinv_byname

Hatize and invert a vector
equal_byname

Compare two matrices "by name" for equality
is_matrix_or_Matrix

Tells whether an object is one of a matrix or a Matrix
log_byname

Logarithm of matrix elements
iszero_byname

Test whether this is the zero matrix
exp_byname

Exponential of matrix elements
logarithmicmean_byname

Name- and element-wise logarithmic mean of matrices
mean_byname

Name- and element-wise arithmetic mean of matrices
matsbyname-package

matsbyname: An Implementation of Matrix Mathematics
logmean

Logarithmic mean of two numbers
margin_from_types_byname

Translate row and column types to integer margins
matrixproduct_byname

Name-wise matrix multiplication
matricize_byname

Matricize a vector
:=

Assignment
naryapply_byname

Apply a function "by name" to any number of operands
identize_byname

Named identity matrix or vector
naryapplylogical_byname

Apply a function logically to numbers, matrices, or lists of numbers or matrices
identical_byname

Compare two matrices "by name" for exact equality
pow_byname

Powers of matrix elements
prodall_byname

Product of all elements in a matrix
replaceNaN_byname

Replace NaN values with a value
prepare_.FUNdots

Prepare the .FUNdots argument for *apply_byname functions.
rowprods_byname

Row products, sorted by name
quotient_byname

Name-wise matrix element division
rename_to_piece_byname

Rename matrix rows and columns by piece of row or column names
rename_to_pref_suff_byname

Rename matrix rows and columns by prefix and suffix
rowsums_byname

Row sums, sorted by name
%>%

Pipe operator
prep_vector_arg

Prepare a vector argument
organize_args

Organize binary arguments
select_rowcol_piece_byname

Select or remove rows or columns based on pieces of the names.
select_cols_byname

Select columns of a matrix (or list of matrices) by name
samestructure_byname

Test whether matrices or lists of matrices have same structure
ncol_byname

Get the number of columns in a "byname" matrix.
nrow_byname

Get the number of rows in a "byname" matrix.
selectzerocols_byname

Select zero columns
select_rows_byname

Select (or de-select) rows of a matrix (or list of matrices) by name
selectzerorows_byname

Select zero rows
setcoltype

Sets column type for a matrix or a list of matrices
switch_notation_byname

Change row and column name notation
setcolnames_byname

Sets column names
setrowtype

Sets row type for a matrix or a list of matrices
vec_from_store_byname

Create a vector with labels from a matrix and values from a vector store
vectorize_byname

Vectorize a matrix
setrownames_byname

Sets row names
rowtype

Row type
sumall_byname

Sum of all elements in a matrix
transpose_byname

Transpose a matrix by name
svd_byname

Calculate the singular value decomposition of a matrix
sort_rows_cols

Sorts rows and columns of a matrix
trim_rows_cols

Trim rows and/or columns from a matrix
unaryapply_byname

Apply a unary function by name
sum_byname

Name-wise addition of matrices