Hi, I can't seem to get an answer for this by searching through the R-help archives: How does one remove leading brackets in print? For example,>print( 3 ) >[1] 3Would it be possible to get rid of the "[1]"? Of course the effect is the same without "print", as in,>3 >[1] 3but I would only be interested in omitting brackets in printing, if that's possible. Thanks very much!
>-----Original Message----- >From: r-help-bounces at stat.math.ethz.ch >[mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of R A F >Sent: Tuesday, April 29, 2003 11:42 AM >To: r-help at stat.math.ethz.ch >Cc: raf1729 at hotmail.com >Subject: [R] Remove leading brackets in print? > > >Hi, I can't seem to get an answer for this by searching >through the R-help archives: How does one remove leading >brackets in print? > >For example, >>print( 3 ) >>[1] 3 > >Would it be possible to get rid of the "[1]"? > >Of course the effect is the same without "print", as in, >>3 >>[1] 3 >but I would only be interested in omitting brackets in >printing, if that's possible. > >Thanks very much!Use cat() instead of print(). You will also generally need to append a newline character ("\n") to the output, as I do below. Thus, you would use:> cat(3, "\n")3 See ?cat for more information. HTH, Marc Schwartz
Something like:> cat(3, "\n")3 Is this what you are looking for? On Tue, 29 Apr 2003, R A F wrote:> Date: Tue, 29 Apr 2003 16:42:06 +0000 > From: R A F <raf1729 at hotmail.com> > To: r-help at stat.math.ethz.ch > Cc: raf1729 at hotmail.com > Subject: [R] Remove leading brackets in print? > > Hi, I can't seem to get an answer for this by searching through the > R-help archives: How does one remove leading brackets in print? > > For example, > >print( 3 ) > >[1] 3 > > Would it be possible to get rid of the "[1]"? > > Of course the effect is the same without "print", as in, > >3 > >[1] 3 > but I would only be interested in omitting brackets in printing, if > that's possible. > > Thanks very much! > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://www.stat.math.ethz.ch/mailman/listinfo/r-help >-- Cheers, Kevin ------------------------------------------------------------------------------ /* Time is the greatest teacher, unfortunately it kills its students */ -- Ko-Kang Kevin Wang Master of Science (MSc) Student SLC Tutor and Lab Demonstrator Department of Statistics University of Auckland New Zealand Homepage: http://www.stat.auckland.ac.nz/~kwan022 Ph: 373-7599 x88475 (City) x88480 (Tamaki)