how to copy and paste my table in R to Excel?

image

I tried to copy and paste directly to email or excel. But it doesn't work. For example, if I paste the table here:

Group.1 x
1 1 73.50558
2 2 72.44681
3 3 71.07353
4 4 70.55556
5 5 69.30769
6 6 62.81818
7 7 73.53659

I run Linux so I do not use Excel but you probably should consider writing the data to the file
See https://www.marsja.se/r-excel-tutorial-how-to-read-and-write-xlsx-files-in-r/

1 Like

I agree with @jrkrideau that you might do better writing your table to file. You could also use write.csv and then open the csv file in Excel, if reading/writing excel files is tricky (which it sometimes can be).

If you're really determined to copy and paste your data directly from R, though, one thing you could try would be the View() function in RStudio. Let's say you're working in RStudio and your table is called "tab". You could do View(tab), and the data viewer pane will open up, showing you a more Excel-like view of the data. I've generally had pretty good luck copying/pasting from the table viewer into excel, google sheets, etc.

2 Likes

You can also get good results with clipr::write_clip(my_df).

5 Likes

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.