Skip to content

Several Basic Questions

4 messages · Yao, Minghua, Brian Ripley

#
Hello, everyone,

I am having several basic questions that I haven't found the answer to from
the manuals:

1. How to remove "[1]" when a single line message is printed?
2. How to print several variables (e.g., a character string and a numeric
variable) at the same line?
3. How to have the control of the accuracy of variables? e.g., in the
following,
[1] 1134567
I want variable to have an accuracy of 2 digits behind the decimal point
instead of all the digits behind the point being cut off.

Thank you in advance for any help.

Minghua
#
On Tue, 20 May 2003, Minghua Yao wrote:

            
Use cat()
Use cat()
Use cat, round and format:
1134566.91 


These may not be explicit in the R manuals, but they are in all good books 
on R (see the FAQ).
#
Dear Prof. Ripley,

Thank you for your reply. It works fine except for question 3. I got
1134567

May variable z has been rounded to 0 digit behind the point at the very
beginning. How to avoid that?

Minghua

-----Original Message-----
From: Prof Brian Ripley [mailto:ripley at stats.ox.ac.uk]
Sent: Tuesday, May 20, 2003 9:12 AM
To: Minghua Yao
Cc: R Help
Subject: Re: [R] Several Basic Questions
On Tue, 20 May 2003, Minghua Yao wrote:

            
from
Use cat()
Use cat()
Use cat, round and format:
1134566.91


These may not be explicit in the R manuals, but they are in all good books
on R (see the FAQ).

--
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595
#
On Tue, 20 May 2003, Minghua Yao wrote:

            
Read the help on format (and print), especially its `digits' argument.
More generally, read the help pages on functions new to you!