[R] Multibyte characters in (row) names
David Winsemius
dwinsemius at comcast.net
Mon Aug 2 19:13:06 CEST 2010
On Aug 2, 2010, at 12:56 PM, Richard R. Liu wrote:
> I have an array with names which contain multibyte characters. When
> I try to
> write the array to a file using write.table and row.names = T I
> receive an error
> message when the first such name is encountered, saying that I have
> not
> specified the option to generate NA instead. I really would be
> satisfied if the
> row name in the file were exactly what is displayed when I print the
> array on
> the console, e.g., "en.\xc2". The only way I have found to avoid
> this is create
> a new array containing in one column a deparse of the original row
> name and in
> the other the value. This "solution" is ugly; "en.\xc2" becomes
> "\"en.\\xc2\"".
>
> Is there a more straight forward way of dealing with multibyte
> characters?
Do you want to provide a worked example that produces the error? I am
not getting such an error
> mtx <- matrix(1, nrow=1)
> rownames(mtx) <- "en.\xc2"
> mtx
[,1]
en.\xc2 1
> write.table(mtx, file="test.txt")
What I see in that file is
"V1"
"en.¬" 1
(The character following the period is a logical negation symbol (or
an IBM keyboard carriage return) on my display.)
--
David Winsemius, MD
West Hartford, CT
More information about the R-help
mailing list