[R] R 4.2.0: write.table() "clipboard-1024" copies only columns name

Tomas Kalibera tom@@@k@||ber@ @end|ng |rom gm@||@com
Thu Apr 28 19:10:06 CEST 2022

On 4/28/22 16:02, Jinsong Zhao wrote:
> Hi Sergiy,
> I can confirm this. I don't find any bug report related with 
> "clipboard" on bugzilla. I will open a bug report.

I confirm this is a bug in the connections code implementation of 
"clipboard". R 4.2 has a new version which uses Unicode and 
unfortunately with this bug which has not been discovered before 
release. Now fixed in R-devel and R-patched, so will be fixed in R 4.2.1.

The bug only affects Windows, only writing to clipboard in subsequent 
operations, and only the connections code.

There is also clipboard support in base R in the utils package, e.g. 
writeClipboard(), which is not affected.

However, I don't see how it would easily solve the problem at hand. One 
could write to a file, then read it, and then pass it to writeClipboard, 
but once we have the file, we can also read it directly.

Sorry for the inconvenience,

> Best,
> Jinsong
> On 2022/4/28 21:32, Sergei Ko wrote:
>> Hi Erich,
>> Thanks for the suggestion. The "write_clip" solution works as intended.
>> I wanted to raise a question regarding the "write.table"
>> function behaviour in R 4.2.0 because I used this solution 
>> extensively in
>> my hybrid Excel/R tools to return results. I expected stable 
>> behaviour from
>> a function from "utils".
>> While on the topic - can someone please confirm this bug?
>> Regards,
>> Sergiy
>> On Thu, Apr 28, 2022 at 9:54 AM Erich Subscriptions <
>> erich.subs using neuwirth.priv.at> wrote:
>>> Die you try clipr::write_clip as an alternative?
>>>> On 28.04.2022, at 10:38, Sergei Ko <sggp.sergei using gmail.com> wrote:
>>>> I used write.table(mat, "clipboard-1024", sep="\t", 
>>>> row.names=FALSE) to
>>>> copy from R to Excel in previous versions. After updating to 4.2.0 it
>>>> copies column names only to clipboard. Win 10 64 bit. Any ideas on 
>>>> how to
>>>> fix it? Try this:
>>>> mat = matrix(0, 2, 3)
>>>> write.table(mat, "clipboard-1024", sep="\t", row.names=FALSE)
>>>>        [[alternative HTML version deleted]]
> ______________________________________________
> R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide 
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

More information about the R-help mailing list