[R] Rounding Elements of a Matrix

Joshua Wiley jwiley.psych at gmail.com
Mon Sep 20 18:25:39 CEST 2010


Hi Raphael,

mat <- matrix(rnorm(100), ncol = 2)
round(mat, 2)

for documentation see ?round

Cheers,

Josh

On Mon, Sep 20, 2010 at 9:21 AM, Raphael Fraser
<raphael.fraser at gmail.com> wrote:
> I have a 2x50 matrix and would like to round all the elements to 2
> decimal places. Can any one help?
>
> Thanks,
> Raphael
>
> ______________________________________________
> R-help at 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.
>



-- 
Joshua Wiley
Ph.D. Student, Health Psychology
University of California, Los Angeles
http://www.joshuawiley.com/



More information about the R-help mailing list