Skip to content

Commit

Permalink
Merge branch 'release-0.2.7'
Browse files Browse the repository at this point in the history
  • Loading branch information
MatthewHeun committed Oct 30, 2018
2 parents 850fb3d + 8e2f50b commit 9074a98
Show file tree
Hide file tree
Showing 37 changed files with 5,080 additions and 51 deletions.
2 changes: 2 additions & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
^docs$
^_pkgdown\.yml$
^.*\.Rproj$
^\.Rproj\.user$
9 changes: 6 additions & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
Package: matsindf
Type: Package
Title: Work with matrices in data frames
Version: 0.2.6
Date: 2018-07-03
Version: 0.2.7
Date: 2018-10-30
Authors@R: c(person("Matthew", "Heun", role = c("aut", "cre"),
comment = c(ORCID = "0000-0002-7438-214X"),
email = "[email protected]"))
Author: Matthew Heun [aut, cre]
Maintainer: Matthew Heun <[email protected]>
Expand All @@ -12,7 +13,7 @@ Description: Provides functions to collapse a tidy data frame into matrices in a
License: MIT + file LICENSE
Encoding: UTF-8
LazyData: true
RoxygenNote: 6.0.1
RoxygenNote: 6.1.0
Depends: R (>= 2.10)
Imports:
matsbyname,
Expand All @@ -29,3 +30,5 @@ Suggests:
testthat
VignetteBuilder:
knitr
URL: https://github.com/MatthewHeun/matsindf
BugReports: https://github.com/MatthewHeun/matsindf/issues
5 changes: 5 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
# News for `matsindf`


## matsindf 0.2.7 (2018-10-309)

* Added documentation website.


## matsindf 0.2.6 (2018-07-03)

* New function `index_column` that ratios both numbers and matrices relative to an initial time.
Expand Down
34 changes: 18 additions & 16 deletions R/utilities.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
#' Optionally, values can be dropped.
#'
#' @param .matrix the IO-style matrix to be converted to a data frame with rows, columns, and values
#' @param matvals a string for the name of the output column containing values
#' @param rownames a string for the name of the output column containing row names
#' @param colnames a string for the name of the output column containing column names
#' @param rowtype a string for the name of the output column containing row types
#' @param coltype a string for the name of the output column containing column types
#' @param drop if specified, the value to be dropped from output.
#' @param matvals a string for the name of the output column containing values. Default is "\code{matvals}".
#' @param rownames a string for the name of the output column containing row names. Default is "\code{rownames}".
#' @param colnames a string for the name of the output column containing column names. Default is "\code{colnames}".
#' @param rowtype a string for the name of the output column containing row types. Default is \code{NULL}.
#' @param coltype a string for the name of the output column containing column types. Default is \code{NULL}.
#' @param drop if specified, the value to be dropped from output. Default is \code{NA}.
#' For example, \code{drop = 0} will cause \code{0} entries in the matrices to be deleted from output.
#' If \code{NA}, no values are dropped from output.
#'
Expand Down Expand Up @@ -43,8 +43,8 @@
#' mat_to_rowcolval(0, matvals = "vals",
#' rownames = "rows", colnames = "cols",
#' rowtype = "rt", coltype = "ct", drop = 0)
mat_to_rowcolval <- function(.matrix, matvals,
rownames, colnames,
mat_to_rowcolval <- function(.matrix, matvals = "matvals",
rownames = "rownames", colnames = "colnames",
rowtype = NULL, coltype = NULL,
drop = NA){
if (is.matrix(.matrix)) {
Expand Down Expand Up @@ -86,12 +86,12 @@ mat_to_rowcolval <- function(.matrix, matvals,
#' in which case the value in the \code{values} column is returned.
#'
#' @param .DF a tidy data frame containing columns for row names, column names, and values
#' @param rownames the name of the column in \code{.DF} containing row names (a string)
#' @param colnames the name of the column in \code{.DF} containing column names (a string)
#' @param matvals the name of the column in \code{.DF} containing values with which to fill the matrix (a string)
#' @param fill the value for missing entries in the resulting matrix (default is \code{0})
#' @param rowtype an optional string identifying the types of information found in rows of the matrix to be constructed
#' @param coltype an optional string identifying the types of information found in columns of the matrix to be constructed
#' @param matvals the name of the column in \code{.DF} containing values with which to fill the matrix (a string). Default is "\code{matvals}".
#' @param rownames the name of the column in \code{.DF} containing row names (a string). Default is "\code{rownames}".
#' @param colnames the name of the column in \code{.DF} containing column names (a string). Default is "\code{colnames}".
#' @param rowtype an optional string identifying the types of information found in rows of the matrix to be constructed. Default is "\code{NULL}".
#' @param coltype an optional string identifying the types of information found in columns of the matrix to be constructed. Default is "\code{NULL}".
#' @param fill the value for missing entries in the resulting matrix. default is \code{0}.
#'
#' @return a matrix with named rows and columns and, optionally, row and column types
#' @export
Expand Down Expand Up @@ -128,7 +128,9 @@ mat_to_rowcolval <- function(.matrix, matvals,
#' ct = c("Industries", "Industries", "Industries")))
#' \dontrun{rowcolval_to_mat(data4, rownames = "rows", colnames = "cols",
#' matvals = "vals", rowtype = "rt", coltype = "ct")}
rowcolval_to_mat <- function(.DF, matvals, rownames, colnames, rowtype = NULL, coltype = NULL, fill = 0){
rowcolval_to_mat <- function(.DF, matvals = "matvals",
rownames = "rownames", colnames = "colnames",
rowtype = NULL, coltype = NULL, fill = 0){
if (!is.null(rowtype)) {
# If rowtype is supplied and is not NA, check if it is one of the columns of .DF
if (rowtype %in% colnames(.DF)) {
Expand Down Expand Up @@ -216,7 +218,7 @@ rowcolval_to_mat <- function(.DF, matvals, rownames, colnames, rowtype = NULL, c
#' @return a data frame with same number of rows as \code{.DF} and the following columns:
#' grouping variables of \code{.DF}, \code{var_to_index}, \code{time_var},
#' and one additional column containing indexed \code{var_to_index}
#' named with the value of \code{var_to_index}.
#' named with the value of \code{indexed_var}.
#'
#' @importFrom matsbyname elementquotient_byname
#' @importFrom dplyr inner_join
Expand Down
37 changes: 37 additions & 0 deletions README.Rmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
---
output: github_document
bibliography: vignettes/References.bib
---

# matsindf

The `R` package `matsindf` provides
ways to interact with matrices in data frames.


## Installation

You can install `matsindf` from github with:

```{r gh-installation, eval = FALSE}
# install devtools if not already installed
# install.packages("devtools")
devtools::install_github("MatthewHeun/matsindf")
# To build vignettes locally, use
devtools::install_github("MatthewHeun/matsindf", build_vignettes = TRUE)
```


## History

The functions in this package were used in the paper
[Heun et al. [-@Heun:2018]](https://doi.org/10.1016/j.apenergy.2018.05.109).


## More Information

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


## References
2 changes: 0 additions & 2 deletions README.md

This file was deleted.

131 changes: 131 additions & 0 deletions docs/LICENSE-text.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 9074a98

Please sign in to comment.