-
Notifications
You must be signed in to change notification settings - Fork 0
/
README.Rmd
70 lines (49 loc) · 2.03 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
# adjHelpR
<!-- badges: start -->
[![Travis build status](https://travis-ci.com/gi0na/adjHelpR.svg?branch=master)](https://travis-ci.com/gi0na/adjHelpR)
<!-- badges: end -->
The goal of adjHelpR is to provide tools to generate adjacency matrices from weighted edgelists, create weighted edgelists from edgelists with repeated edges, and handle these objects.
It exploits `dplyr` and `tibble`s to deal efficiently with large edgelists, and `Matrix` sparse matrices to store adjacency matrices in sparse format.
## Installation
You can install the released version of adjHelpR from [CRAN](https://CRAN.R-project.org) with:
``` r
install.packages("adjHelpR")
```
And the development version from [GitHub](https://github.com/) with:
``` r
# install.packages("devtools")
devtools::install_github("gi0na/adjHelpR")
```
## Example
This is a basic example on how to generate a weighted adjacency matrix from an edge list:
```{r example}
library(adjHelpR)
el <- data.frame(from= c('a','b','b','c','d','d'),
to = c('b','c','d','a','b','a'),
attr= c( 12, 6, 12 , 6 , 6 , 6 ))
(adj <- get_adjacency(el))
(el_unweighted <- tibble::as_tibble(do.call(rbind,
apply(el, 1, function(row) matrix(rep(row[1:2], each=as.integer(row[3])), ncol = 2))),
.name_repair='minimal'))
(adj <- get_adjacency(el_unweighted, multiedge = TRUE))
```
# Acknowledgements
The research and development behind `adjHelpR` is performed at the Chair of Systems Design, ETH Zürich.
# Contributors
[Giona Casiraghi](http://giona.info)
[Christian Zingg](https://www.sg.ethz.ch/team/people/czingg/)
# Copyright
`adjHelpR` is licensed under the [GNU Affero General Public License](https://choosealicense.com/licenses/agpl-3.0/).
\(c\) Copyright ETH Zürich, 2019-2021