paste tab and print

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

paste tab and print

vincent-18
Dear all,

info = paste('a', 'b', sep='\t')
print(info , quote=F)

doesn't produce the same result with R201 and R220
(under Windows2000)
R 2.0.1 : [1] a   b
R 2.2.0 : [1] a\tb

I did read the CHANGESR220 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.

Thanks
Vincent

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Reply | Threaded
Open this post in threaded view
|

Re: paste tab and print

Brian Ripley
On Mon, 9 Jan 2006 [hidden email] 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,                  [hidden email]
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

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Reply | Threaded
Open this post in threaded view
|

Re: paste tab and print

vincent-18
Prof Brian Ripley a écrit :

>> cat(info, "\n")

Thank you very much. It works.

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html