Thank you Qiang Kou , it worked :)

Appreciate it.






From:   Qiang Kou <qkou@umail.iu.edu>
To:     Pavneet Arora/UK/RoyalSun@RoyalSun
Cc:     R help <r-help@r-project.org>
Date:   25/03/2014 13:37
Subject:        Re: [R] Digits in R



Have you tried "round(vars, digits = 4)" ?

KK


On Tue, Mar 25, 2014 at 7:17 AM, Pavneet Arora <
pavneet.arora@uk.rsagroup.com> wrote:
Hello All,

I am new in R, so please excuse the basic questions.
But how do you change the number of digits to be displayed?

I have done the following, hoping I will get 4 decimal places in my
answer:

vars <- var(cbind(Sepal.l,Sepal.w,Petal.l,Petal.w))
print(vars,digits=4)

But as seen below from the output, that is not the case

> print(vars,digits=4)
         Sepal.l  Sepal.w Petal.l Petal.w
Sepal.l  0.68569 -0.04074  1.2743  0.5163
Sepal.w -0.04074  0.19363 -0.3287 -0.1212
Petal.l  1.27432 -0.32873  3.1163  1.2956
Petal.w  0.51627 -0.12124  1.2956  0.5810

How come the Sepal.l and Sepal.w does not come with only 4 decimal places.
Can someone tell me where I am going wrong?

Also if I use the "options(digits=4)"- How do I make it to go back to
Normal or default, which is 7 in this case.?
***********************************************************************************************************************************************************************************************************************
MORE TH>N is a trading style of Royal & Sun Alliance Insurance plc (No. 
93792). Registered in England and Wales at St. Mark?s Court, Chart Way, 
Horsham, West Sussex, RH12 1XL.

Authorised by the Prudential Regulation Authority and regulated by the 
Financial Conduct Authority and the Prudential Regulation Authority.
************************************************************************************************************************************************************************************************************************

        [[alternative HTML version deleted]]


______________________________________________
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.




-- 
Qiang Kou
qkou@umail.iu.edu
School of Informatics and Computing, Indiana University

______________________________________________________________________________________________
The following message has been automatically added to comply with the RSA 
Group IT Security requirements:

This email arrived via the internet, over a secure Opportunistic TLS 
encryption connection. 
This means the email was sent using encryption but the senders domain has 
not been verified for its authenticity. 
As such you still need to be cautious about its origin and content.
Replies which contain sensitive information or legal/contractual 
obligations are particularly vulnerable. 
In these cases you should not reply unless you are authorised to do so.

If you have any questions, please speak to the Service Centre on x7979.
______________________________________________________________________________________________


***********************************************************************************************************************************************************************************************************************
MORE TH>N is a trading style of Royal & Sun Alliance Insurance plc (No. 93792). Registered in England and Wales at St. Mark’s Court, Chart Way, Horsham, West Sussex, RH12 1XL. 

Authorised by the Prudential Regulation Authority and regulated by the Financial Conduct Authority and the Prudential Regulation Authority.
************************************************************************************************************************************************************************************************************************

	[[alternative HTML version deleted]]


