How to round all values in a matrix?

后端 未结 1 739
遇见更好的自我
遇见更好的自我 2020-12-18 20:38

I use the following method to store all my correlations in a matrix:

corrs <- cor(dataset, use=\"pairwise.complete.obs\")

But now I\'d l

相关标签:
1条回答
  • 2020-12-18 21:25

    Just as in your other question, use the function (round) you found :)

    corrs <- round(cor(dataset, use="pairwise.complete.obs"), 2)
    

    For example:

    > round(cor(cars),2)
          speed dist
    speed  1.00 0.81
    dist   0.81 1.00
    
    0 讨论(0)
提交回复
热议问题