[R] print(), paste()

Ko-Kang Kevin Wang kwan022 at stat.auckland.ac.nz
Tue Sep 24 13:34:05 CEST 2002


Hi,

Suppose I have the following lines at the end of a function:
  answer <- c(2, 1, 0, 4, 5) # In fact, answer will be generate in my
                             # function
  print(answer) # Print the answer
  # Now, find the best fitted n degree polynomial
  print(paste("The best fit is with", which.min(answer) - 1,
              "-degree polynomial"))
this will return:
  [1] 2 1 0 4 5
  [1] "The best fit is with 2 -degree polynomial"  

Two questions:

1) How can I supress the [1] in the second line in the output?

2) The second line has ...with 2 -degree... , how can I make it display
...with 2-degree...?

In other words I'd like my output to look like:
  [1] 2 1 0 4 5
  "The best fit is with 2-degree polynomial"    


Cheers,

Kevin

------------------------------------------------------------------------------
Ko-Kang Kevin Wang
Postgraduate PGDipSci Student
Department of Statistics
University of Auckland
New Zealand
Homepage: http://www.stat.auckland.ac.nz/~kwan022


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