-1

I'm trying to export some results obtained from R into Excel unsuccesfully. I have tried the following codes:

write.table(ALBERTA1, "D:/ALBERTA1.txt", sep="\t")
write.csv(ALBERTA1,":\ALBERTA1.csv")
your_filename_in_R = read.csv("ALBERTA1.csv")
your_filename_in_R = read.csv("ALBERTA1.csv")
write.csv(df, file = "ALBERTA1.csv")
your_filename_in_R = read.csv("ALBERTA1.csv")
write.csv(ALBERTA1, "ALBERTA1.csv")
write.table(ALBERTA1, 'clipboard', sep='\t')
write.table(ALBERTA1,"ALBERTA1.txt")
write.table(as.matrix(ALBERTA2),"ALBERTA2.txt")
write.table(as.matrix(vecm.pred$fcst$Alberta_Females[,1]),"vecm.pred$fcst$Alberta_Females[,1].txt")
write.table(as.matrix(foo),"foo.txt")
write.xlsx(ALBERTA2, "/ALBERTA2.xlsx")
write.table(ALBERTA1, "D:/ALBERTA1.txt", sep="\t").

But my data from excel file is still messed up togheter and consequently i can't operate any computations. the two data are inside the same colums. the Please can you suggest me some other functions?enter image description here

joran
  • 169,992
  • 32
  • 429
  • 468
ntamjo achille
  • 781
  • 1
  • 7
  • 10
  • 4
    Try `write.csv2`. Or supply `write.table` with the seperator your Excel version expects. Or tell Excel when importing the data which seperator has been used. – Roland Oct 15 '13 at 15:48
  • Turn off row.names in that last line: `write.table(ALBERTA1, "D:/ALBERTA1.txt", sep="\t", row.names=FALSE)` – Ricardo Saporta Oct 15 '13 at 15:52

1 Answers1

3

What I did to manage the CSV data in Excel:

  1. In excel find "Data" in the top Menu
  2. Choose the "Text to Columns ..." in the middle area of the menu.
  3. follow the instruction and then you get the data in columns

https://superuser.com/questions/364555/how-to-break-a-spreadsheet-containing-csv-into-multiple-columns

Community
  • 1
  • 1
mushroom
  • 41
  • 3
  • 3
    I'm guessing the unexplained downvote came from an R user, but those of us who use Excel on occasion for post-processing R output should recognize the usefulness of the Excel's Data/Text to Column... "wizard" in Excel. I usually use it to process copied screen output with the fwf capabilities. – IRTFM Oct 15 '13 at 16:42
  • @Roland, Riccardo and Dwin, I have tried both codes but still in trouble. In my excel cell, i have a number in a particular shape as you can see it below. It's very weird but maybe it's because of my excel settings? Please is someone can tell me how to manage to get these outcomes properly? 555.486.398.454.784 578.471.113.839.479 54.519.051.119.506 505.751.821.039.884 49.473.945.115.391 534.697.459.336.592 508.084.693.230.311 560.466.595.443.406 563.546.841.885.183 459.615.921.364.787 407.820.389.877.528 416.737.818.817.038 – ntamjo achille Oct 16 '13 at 15:49
  • All codes you showed me are valid. However, because my computer settings were set up in Italian, this is why i got in trouble to export data from R to excel. Anyway, i have set up the excel in United states style and results(numbers) from R to excel can be read correctly. Thank you all of you! – ntamjo achille Oct 25 '13 at 21:07