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

License

MIT + file LICENSE

Issues

Pull Requests

Stars

Forks

Maintainer

Matthew Heun

Last Published

October 19th, 2023

Functions in matsbyname (0.6.6)

count_vals_byname

Count the number of matrix entries that meet a criterion
and_byname

And "by name"
Iminus_byname

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

Are all matrix elements TRUE?
abs_byname

Absolute value of matrix elements
binaryapply_byname

Apply a binary function "by name"
any_byname

Are any matrix elements TRUE?
clean_byname

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

Column products, sorted by name
equal_byname

Compare two matrices "by name" for equality
exp_byname

Exponential of matrix elements
count_vals_incols_byname

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

Column sums, sorted by name
Matrix

Create a Matrix amenable to use in the matsbyname package
aggregate_byname

Aggregate rows and columns in a matrix
coltype

Column type
count_vals_inrows_byname

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

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

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

Create a "byname" matrix from a vector
iszero_byname

Test whether this is the zero matrix
replaceNaN_byname

Replace NaN values with a value
compare_byname

Compare matrix entries to a value
cumsum_byname

Cumulative sum that respects row and column names
create_colvec_byname

Create column vectors from data
complete_and_sort

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

Apply a function cumulatively to a list of matrices or numbers
.data

Data pronoun
logmean

Logarithmic mean of two numbers
cumprod_byname

Cumulative element-product that respects row and column names
getcolnames_byname

Gets column names
margin_from_types_byname

Translate row and column types to integer margins
complete_rows_cols

Complete rows and columns in one matrix relative to another
rowprods_byname

Row products, sorted by name
getrownames_byname

Gets row names
sort_rows_cols

Sorts rows and columns of a matrix
create_rowvec_byname

Create row vectors from data
difference_byname

Name-wise subtraction of matrices
eigenvalues_byname

Calculate eigenvalues of a matrix
fractionize_byname

Compute fractions of matrix entries
ncol_byname

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

Calculate eigenvectors of a matrix
sum_byname

Name-wise addition of matrices
nrow_byname

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

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

Row sums, sorted by name
kvec_from_template_byname

Create a constant vector from matrix a
list_of_rows_or_cols

Named list of rows or columns of matrices
trim_rows_cols

Trim rows and/or columns from a matrix
geometricmean_byname

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

Names of zero rows and columns
rowtype

Row type
invert_byname

Invert a matrix
sumall_byname

Sum of all elements in a matrix
svd_byname

Calculate the singular value decomposition of a matrix
hadamardproduct_byname

Name-wise matrix Hadamard multiplication
identical_byname

Compare two matrices "by name" for exact equality
unaryapply_byname

Apply a unary function by name
matsbyname-package

matsbyname: An Implementation of Matrix Mathematics that Respects Row and Column Names
mean_byname

Name- and element-wise arithmetic mean of matrices
hatinv_byname

Hatize and invert a vector
hatize_byname

Creates a diagonal "hat" matrix from a vector
is.Matrix

Is an object a Matrix?
naryapply_byname

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

Apply a function logically to numbers, matrices, or lists of numbers or matrices
:=

Assignment
identize_byname

Named identity matrix or vector
matricize_byname

Matricize a vector
log_byname

Logarithm of matrix elements
prepare_.FUNdots

Prepare the .FUNdots argument for *apply_byname functions.
logarithmicmean_byname

Name- and element-wise logarithmic mean of matrices
prodall_byname

Product of all elements in a matrix
select_rowcol_piece_byname

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

Name-wise matrix element division
select_rows_byname

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

Name-wise matrix multiplication
pow_byname

Powers of matrix elements
organize_args

Organize binary arguments
vec_from_store_byname

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

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

Vectorize a matrix
prep_vector_arg

Prepare a vector argument
%>%

Pipe operator
selectzerocols_byname

Select zero columns
samestructure_byname

Test whether matrices or lists of matrices have same structure
select_cols_byname

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

Sets column names
setcoltype

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

Rename matrix rows and columns by prefix and suffix
setrownames_byname

Sets row names
selectzerorows_byname

Select zero rows
setrowtype

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

Change row and column name notation
transpose_byname

Transpose a matrix by name
aggregation_map_helpers

Aggregation map conversions
aggregate_pieces_byname

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