Displaying 4 results from an estimated 4 matches for "uppertriangl".
Did you mean:
uppertriangle
2007 Apr 23
1
how to convert the lower triangle of a matrix to a symmetricmatrix
Sorry if this answer was already given, or if I miss the point,
but did you have a look to "lowerTriangle" and "upperTriangle" functions
in the "gdata" package ?
# example
# A<-matrix(rnorm(9),3,3)
# B<-B<-matrix(NA,dim(A)[1],dim(A)[2])
# lowerTriangle(B)<-lowerTriangle(A)
# upperTriangle(B)<-lowerTriangle(A)
# diag(B)<-diag(A)
Hope this helps, sorry if it was already answered.
Olivier...
2007 Oct 10
3
as.dist with diagonal unequal zero
....
I tried with as.dist
w<-as.dist(w, diag = TRUE)
> w
1 2 3 4 5
1 0
2 2 0
3 3 8 0
4 4 9 14 0
5 5 10 15 20 0
but found no way to keep the diagonal that is in the matrix.
I also tried this but as I expected it makes no difference:
w<-matrix(1:25, ncol=5, nrow=5)
> upperTriangle(w)<-NA
> w
[,1] [,2] [,3] [,4] [,5]
[1,] 1 NA NA NA NA
[2,] 2 7 NA NA NA
[3,] 3 8 13 NA NA
[4,] 4 9 14 19 NA
[5,] 5 10 15 20 25
> w<-as.dist(w, diag = TRUE)
> w
1 2 3 4 5
1 0
2 2 0
3 3 8 0
4 4 9 14 0...
2005 Dec 13
0
Updated version of gdata, gtools, gplots and gmodels
...39;s suggestion)
- Updated Greg and Jim's email adresses
- ll.R: Suppressed warning message in attach() call.
- frameApply.Rd, reorder.Rd: Remove explicit loading of
gtools in examples, so that failure to import functions from
gtools gets properly caught by running the examples.
- upperTriangle.R, man/upperTriangle.Rd: Add functions for
extracting and modifying the upper and lower trianglular components of
matrices.
- is.what.R: Replaced the "not.using" vector with a more robust
try(get(test)) to find out whether a particular is.* function
returns a logical of len...
2005 Dec 13
0
Updated version of gdata, gtools, gplots and gmodels
...39;s suggestion)
- Updated Greg and Jim's email adresses
- ll.R: Suppressed warning message in attach() call.
- frameApply.Rd, reorder.Rd: Remove explicit loading of
gtools in examples, so that failure to import functions from
gtools gets properly caught by running the examples.
- upperTriangle.R, man/upperTriangle.Rd: Add functions for
extracting and modifying the upper and lower trianglular components of
matrices.
- is.what.R: Replaced the "not.using" vector with a more robust
try(get(test)) to find out whether a particular is.* function
returns a logical of len...