Calling all R programmers please help me.
I want to print in R use the cat function preferably. I want to control the fieldwidth and the number of decimal places for printing a number, just like I used to do in Fortran with F10.2. I cannot work out how to do it in R.
For example I want to print x=10.50 with a fieldwidth of 8 and 2 decimal places using
cat("My number is",x,"\n")
So I want 5 leading blanks and I don't want the trailing zero chopped off.
How do I do it?
I wouldn't ask but I have spent ages trying to find a way without success.
Thanks
Margaret Hurley PhD, CStat
Lancashire School of Health and Postgraduate Medicine
University of Central Lancashire
Preston
PR1 2HE
UK
Tel: 01772 895429
Fax:01772 892992
|