Sisi
Sisi

Reputation: 61

I cannot paste Rstudio console output into Excel anymore

So previously, when I ran statistics in R, I was able to copy and paste to Excel works sheet (for example rstudio console window output), but now it seems like there is a problem. When I now press paste (or ctrl+v), it just leaves it empty and nothing is pasted into the worksheet. It works if I paste it to notepad first and then copy and paste it to Excel.

What is the problem and how can I solve it?

enter image description here

Upvotes: 2

Views: 1312

Answers (2)

LKiwi
LKiwi

Reputation: 1

I have the same problem when trying to copy/paste a tibble, but making it into a data.frame solves the issue. The output from this:

a <- c("abc",9238)
b <- c("def",123)
tibble(a,b)

shows up blank when I copy/paste, but this gives console output that works:

tibble(a,b) %>% data.frame()

Upvotes: 0

deschen
deschen

Reputation: 10996

It might depend on the object you are trying to paste. From my experience it works well with standard classes from R, e.g. copying the output of:

data.frame(A=c("cats","dogs","pig"), B=c("kittens","puppies","pig"))

from the console to Excel works fine.

However, if I convert to something from the tidyverse, e.g.

tibble(A=c("cats","dogs","pig"), B=c("kittens","puppies","pig"))

it doesn't copy nicely anymore. One solution is to not directly paste into Excel, but use the "paste" button, then "paste special", then choose "unicode text".

Some reference here: https://support.microsoft.com/en-us/office/paste-special-e03db6c7-8295-4529-957d-16ac8a778719

Upvotes: 1

Related Questions