Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/krzjoa/matricks
Useful tricks for matrix manipulation.
https://github.com/krzjoa/matricks
algebra matrix matrix-manipulation r
Last synced: 2 months ago
JSON representation
Useful tricks for matrix manipulation.
- Host: GitHub
- URL: https://github.com/krzjoa/matricks
- Owner: krzjoa
- License: other
- Created: 2019-11-20T22:02:00.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2020-03-03T22:15:16.000Z (almost 5 years ago)
- Last Synced: 2024-10-09T15:21:53.796Z (3 months ago)
- Topics: algebra, matrix, matrix-manipulation, r
- Language: R
- Homepage: https://krzjoa.github.io/matricks/
- Size: 1.71 MB
- Stars: 4
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.Rmd
- License: LICENSE
Awesome Lists containing this project
README
---
output: github_document
---```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```# matricks
> Useful tricks for matrix manipulation[![CRAN status](https://www.r-pkg.org/badges/version/matricks)](https://CRAN.R-project.org/package=matricks)
[![Documentation](https://img.shields.io/badge/documentation-matricks-orange.svg?colorB=E91E63)](http://krzjoa.github.io/matricks)
[![Travis build status](https://travis-ci.org/krzjoa/matricks.svg?branch=master)](https://travis-ci.org/krzjoa/matricks)
[![AppVeyor build status](https://ci.appveyor.com/api/projects/status/github/krzjoa/matricks?branch=master&svg=true)](https://ci.appveyor.com/project/krzjoa/matricks)
[![Buy hex stciker](https://img.shields.io/badge/buy%20hex-matricks-green)](https://www.redbubble.com/people/krzjoa/works/43111073-matricks-r-package-hex?asc=u&kind=sticker&p=sticker&size=small)### Installation
`matricks` is available on CRAN, so you can install it using simply:
```{r,message=FALSE, results='hide', eval=FALSE}
install.packages('matricks')
```
If you rather want to install dev version, you can do it with `devtools`.
```{r install.dev, message=FALSE, results='hide', eval=FALSE}
devtools::install_github('krzjoa/matricks')
```### Usage
Main `matricks` functions are `m` and `v`, which provide convenient API to create matrices and vectors.
Why should we write:
```{r matrix_function}
matrix(c(5, 6, 7,
8, 0, 9,
3, 7, 1), nrow = 3, byrow = TRUE)
```
if we can simply create such a matrix like that:
```{r m_function}
library(matricks)m(5, 6, 7|
8, 0, 9|
3, 7, 1)
````v` function is an useful shortcut for creating vertical vectors (single columns)
```{r v_function}
v(1,2,3)
v(1:5)
```Setting values in easier with `matricks`
```{r set_values_function}
mat <- matrix(0, 3, 3)
set_values(mat, c(1, 2) ~ 0.5, c(3, 1) ~ 7)
```