A
A
Anatolitr2020-03-29 16:51:06
R
Anatolitr, 2020-03-29 16:51:06

How to correctly export a table from R to Excel?

There was a problem when exporting a table from R. For some reason, all the data is written in one line (the data is not split into columns, as it should be). At the same time, using View(), the table is displayed in the correct form. I save the table to a csv file using the function

write.table(res.tab, file="/Users/.../result.txt", fileEncoding='UTF-8', dec = ",", sep = "\t")

This is how the table is shown using View()
5e80a756799b4283344444.png
And this is how when opening a csv file in Excel (all data is written in one line, not split into columns)
5e80a7a75850a043501058.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Z
zexer, 2020-03-29
@Anatolitr

Select the first column in its entirety, go to the "Data" section, then click the "Text to Columns" function. In the pop-up window, click "With separator", and then select the tab separator.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question