-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathseq2mat.Rd
36 lines (35 loc) · 1.04 KB
/
seq2mat.Rd
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
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/auxiliar.R
\name{seq2mat}
\alias{seq2mat}
\title{Transforms a vector to a symmetric matrix}
\usage{
seq2mat(x, dat)
}
\arguments{
\item{x}{names of columns and rows, used to define the size of the matrix}
\item{dat}{Data to fill with the matrix with except the diagonal.}
}
\value{
A square matrix with the diagonal set to 1 and \code{dat} on the
upper and lower triangle with the columns ids and row ids from x.
}
\description{
Fills a matrix of \code{ncol = length(x)} and \code{nrow = length(x)} with
the values in \code{dat} and setting the diagonal to 1.
}
\details{
\code{dat} should be at least \code{choose(length(x), 2)} of length. It
assumes that the data provided comes from using the row and column id to
obtain it.
}
\examples{
seq2mat(LETTERS[1:5], 1:10)
seq2mat(LETTERS[1:5], seq(from = 0.1, to = 1, by = 0.1))
}
\seealso{
\code{\link[=upper.tri]{upper.tri()}} and \code{\link[=lower.tri]{lower.tri()}}
}
\author{
Lluís Revilla
}