read_matrix <- function(path,
transpose=FALSE,
as_sparse=TRUE,
verbose,
...){
if(is.character(path)){
messager("+ Expression matrix (.mtx/.csv/.tsv) detected.",
"Importing as sparse matrix.",v=verbose)
obj <- data.table::fread(path,
...)
} else {
obj <- path
}
#### Convert to sparse matrix ####
if(isTRUE(as_sparse)){
obj <- to_sparse(obj = obj,
verbose = verbose)
}
if(isTRUE(transpose)){
messager("Transposing matrix.",v=verbose)
obj <- Matrix::t(obj)
}
#### Report dimensions ####
messager("Matrix dimensions:",paste(dim(obj),sep=" x "), v=verbose)
#### Return ####
return(obj)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.