Hello,

>
> I'm trying to build a lower triangular matrix (with zeros in the diagonal)
> from a particular dataframe.
>

This example constructs a lower triangular matrix from a vector, not a
data.frame.
(In your example, you also use a vector, the last column of the DF.)

x <- runif(15)
y <- matrix(0, nrow=6, ncol=6)

y[lower.tri(y)] <- x

# See the result
y

Hope this helps,

Rui Barradas


--
View this message in context: 
http://r.789695.n4.nabble.com/built-a-lower-triangular-matrix-from-dataframe-tp4390813p4391162.html
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to