[R] bug in paste?

Ott Toomet siim at obs.ee
Tue Oct 9 13:09:13 CEST 2001


Dear all,

I have strange problems with paste.  Actually I suggest it is a bug (I
send a associated bug report for some days ago too).

I have a vector ce0, a character vector m and I paste them together:

> ce0
 [1] "1985" "9"    "2"    "2"    "1"    "A"    "1"    ""     "NA"   "5"
[11] "1999"

> m
 [1] "<1>" "<2>" "<3>" "<4>" "<4>" "<6>" "<7>" "<8>" "<9>" "<0>" "END"

> paste( ce0, m, sep="", collapse="")
[1] "1985<1>9<2>2<3>2<4>1<4>A1<7>NA<9>5<0>1999END"

                            ^
I expected to get the components of m-vector lying cleanly ordered
between the components of ce0, but it isn't so.  Instead of "1 2 3 4 5
6 7 8 9 0 END" you can see "1 2 3 4 4   7 9 0 END".  The main problem
rises from the "A1" in the row (marked with ^), where there is no
component from m inbetween the ce0 values at all!

However, this needs some background information.  ce0 is originally
from a large dataset (7000 obs x 1200 vars), read from a stata7-file
using read.dta:
> ce0 <- read.dta( "file.dta")[1,230:240]
So I am afraid ce0 contains some kind of extra iformation which I was
not able to figure about.

Can anybody explain me what is going on here?  My R is as follows:

platform i686-pc-linux-gnu
arch     i686
os       linux-gnu
system   i686, linux-gnu
status
major    1
minor    3.1
year     2001
month    08
day      31
language R


Thanks in advance,

Ott Toomet


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