Re: [R] paste tab and print

From: Prof Brian Ripley <ripley_at_stats.ox.ac.uk>
Date: Mon 09 Jan 2006 - 19:31:09 EST

On Mon, 9 Jan 2006 vincent@7d4.com wrote:

> Dear all,
>
> info = paste('a', 'b', sep='\t')
> print(info , quote=F)
>
> doesn't produce the same result with R201 and R220
> (under Windows2000)

(There are no such versions of R, and neither is current.)

> R 2.0.1 : [1] a b
> R 2.2.0 : [1] a\tb
>
> I did read the CHANGESR220 file

Did you mean CHANGES? That is for Windows-specific changes. You meed to look in the NEWS file.

> and tried also the search engine but couldn't find an answer. I
> certainly missed the point, and apologize about that.
>
> So if somebody could tell me how to insert a tab inside
> strings under R.2.2.0., it would be very kind.

You have. A tab inside a string is printed as \t (see ?print.default). However, cat will show you the effect

> info = paste('a', 'b', sep='\t')
> print(info)
[1] "a\tb"
> cat(info, "\n")

a b

(if this survives emailing, or try it yourself).

-- 
Brian D. Ripley,                  ripley@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

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Received on Mon Jan 09 19:39:57 2006

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:41:57 EST