'R 4.2.0: write.table() "clipboard-1024" copies only columns name
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 columns 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)
Solution 1:[1]
From Tomas Kalibera (Bugzilla) Thanks for the report and the nicely minimized example. Fixed in R-devel and will be ported to R-patched. The bug is in new clipboard code and affects any code doing subsequent writes to already opened clipboard connection. This is another repro for the same issue:
con <- file("clipboard")
open(con, "w")
cat("A", file=con)
cat("B", file=con)
close(con)
readLines("clipboard") # should be AB but instead A<garbage>
It only affects Windows because R supports writing to clipboard only on Windows.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Sergiy Kornyev |