0

I try to use write.table() to output build-in dataset EuStockMarkets. EuStockMarkets is like this.

code_picture

However, when I used write.table(EuStockMarkets, ".txt") to output a text file, the dates disappeared.

txt_picture

I want to know how to print the dates with the data as row name?

To display the first picture, just type EuStockMartkets in the console.

write.table(EuStockMarkets, "...\euStockMarkets.txt", sep="\t", na = ".", row.names = TRUE, col.names = TRUE)

And my code is like this.

Kai Lyu
  • 11
  • 2
  • 1
    Welcome to SO! This community has a few [rules](https://stackoverflow.com/help/on-topic) and [norms](https://stackoverflow.com/help/how-to-ask) and following them will help you get a good answer to your question. In particular, it’s best to provide an [MCVE](https://stackoverflow.com/help/mcve) (a minimum, complete, and verifiable example). Good advice for R-specific MVCEs is available [here](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example/5963610#5963610) and [here](https://reprex.tidyverse.org/articles/reprex-dos-and-donts.html). – DanY Sep 07 '18 at 18:28
  • 1
    Please add your code, else nobody can help you. Thanks! – David Sep 07 '18 at 18:33
  • 1
    Also, it’s best to avoid using images of code/data and [here’s why](https://meta.stackoverflow.com/questions/285551/why-not-upload-images-of-code-on-so-when-asking-a-question/285557#285557). Note that you can quickly get your data out of your R session and onto SO by calling `dput(my_df)` and copy/pasting the result. If your data are large, do `dput(head(my_df))`. – DanY Sep 07 '18 at 18:34
  • I've edit my questions. Thank you very much. – Kai Lyu Sep 08 '18 at 14:15

0 Answers0