Returning both halves of a distance matrix in R

I have an external distance object (gdis) and need to convert it to a matrix which contains both halves of the distance matrix. I am currently using the print function to achieve this. It is rather clunky having to print out the entire matrix each time a run the script. Is there any way to avoid this?

wgdis<-print(gdis, upper=TRUE)

Answers


m <- matrix(rpois(50,5), nrow=5)
m2 <- dist(m)
attr(m2, "Upper") <- TRUE
m2
          1         2         3         4         5
1           12.083046 11.135529 11.958261 12.529964
2 12.083046            6.928203 10.148892  8.062258
3 11.135529  6.928203            8.660254  9.643651
4 11.958261 10.148892  8.660254           14.491377
5 12.529964  8.062258  9.643651 14.491377   

Need Your Help

Pointing layout_above to an external ID?

java android layout

When I try to use layout_above to position a view above another view, it can't find the ID if it's not in the same XML file. I'm adding my XML files at run time but I still want to be able to posit...

jmeter multiple users problem

php performance apache2 jmeter

We are using Jmeter to test our Php application running on the Apache 2 web server. I can load up Jmeter to use 25 or 50 threads and the load on the server does not increase, however the response ...