as.Graph: Convert a matrix (or Matrix) to the Graph class.

Description Usage Arguments Examples

View source: R/generics.R

Description

Convert a matrix (or Matrix) to the Graph class.

Usage

1
2
3
4
5
6
7
as.Graph(x, ...)

## S3 method for class 'Matrix'
as.Graph(x, ...)

## S3 method for class 'matrix'
as.Graph(x, ...)

Arguments

x

The matrix to convert

...

Arguments passed to other methods (ignored for now)

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
# converting sparse matrix
mat <- Matrix::rsparsematrix(nrow = 10, ncol = 10, density = 0.1)
rownames(x = mat) <- paste0("feature_", 1:10)
colnames(x = mat) <- paste0("cell_", 1:10)
g <- as.Graph(x = mat)

# converting dense matrix
mat <- matrix(data = 1:16, nrow = 4)
rownames(x = mat) <- paste0("feature_", 1:4)
colnames(x = mat) <- paste0("cell_", 1:4)
g <- as.Graph(x = mat)

lambdamoses/SeuratBasics documentation built on May 6, 2020, 9:32 a.m.