[R] print()

Emmanuel Paradis paradis at isem.univ-montp2.fr
Thu Mar 1 01:02:43 CET 2001


At 14:10 28/02/01 -0800, you wrote:
>Hi, I've two questions. Please help me. Thanks!
>
>--- Question (1) ---
>When I type:   print("School Name")
>the output is: [1] "School Name"
>How to get rid of the '[1]' and the double quotes "" 
>and make the output like this: School Name

Use cat():

	cat("School Name")

or:

	cat("School Name\n")

to add a carriage return.

>--- Question (2) ---
>I got the following output by typing "summary(data)".
>
>    dstuser        dstmethod        numaction    
> Min.   :1.000   Min.   : 1.000   Min.   : 5.00  
> 1st Qu.:2.000   1st Qu.: 2.000   1st Qu.: 7.00  
> Median :2.000   Median : 7.000   Median :16.00  
> Mean   :2.667   Mean   : 5.222   Mean   :23.11  
> 3rd Qu.:4.000   3rd Qu.: 7.000   3rd Qu.:24.00  
> Max.   :4.000   Max.   :10.000   Max.   :66.00  
>
>How to make the output in grid and look like this:
>
>+--------+---------+----------+-----------+
>|        |dstuser  |dstmethod | numaction |  
>+--------+---------+----------+-----------|
>| Min.   |  1.000  |    1.000 |      5.00 |  
>| 1st Qu.|  2.000  |    2.000 |      7.00 | 
>| Median |  2.000  |    7.000 |     16.00 | 
>| Mean   |  2.667  |    5.222 |     23.11 | 
>| 3rd Qu.|  4.000  |    7.000 |     24.00 | 
>| Max.   |  4.000  |   10.000 |     66.00 | 
>+--------+---------+----------+-----------+

I do not see a straightforward way to do this. You can probably write a
function to do this. If you use LaTeX, there is a package on CRAN that
prepares a table in a format suitable for LaTeX.

Emmanuel Paradis

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list