collumn error when exporting to Excel
Thank you all for your help. None of the suggestions worked but this is because I believe I was opening the created file into Excel the wrong way. I managed to open the file in Word and then do indeed get a cvs format. This I was then able to transform to a normal table. Will now try to install the write.XLS package fir I believe that this in the end will save me much work. Thanks to the community for so many prompt responses and plenty of new insight. Greetings, Daniel PS. For those moderators out there I have signed up to the help group and do have a login which works but somehow my emails our not recognized. Sorry for the inconvenience and if there are any suggestions how to fix this that would be great. Cheers -----Original Message----- From: Robert Baer [mailto:rbaer at atsu.edu] Sent: 05 November 2009 15:58 To: Hayes, Daniel; 'r-help at lists.R-project.org' Subject: Re: [R] collumn error when exporting to Excel ?write.csv usually works well for writing a dataframe to import into excel. Use a file name that ends in .csv. ----- Original Message ----- From: "Hayes, Daniel" <D.J.Hayes at liverpool.ac.uk> To: "'r-help at lists.R-project.org'" <r-help at r-project.org> Sent: Thursday, November 05, 2009 3:56 AM Subject: [R] collumn error when exporting to Excel
Dear all, I am attempting to export my results (data.frame) created with the help of a number of you to Excel. In the procedure my column structure is however lost and all results are placed together into the first Excel column. I have tried: write(), write.table(), write.matrix(), export() and have the same results. I Have checked the import/export FAQ and did a Google search to no avail. Any advice would be greatly appreciated. Kind greetings, Daniel
dput(Bolivia.selected.ms.lat.m[1:10,])
structure(list(age = c(0, 0.0833333333333333, 0.166666666666667,
0.25, 0.333333333333333, 0.416666666666667, 0.5, 0.583333333333333,
0.666666666666667, 0.75), country = structure(c(1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L), .Label = c("Bolivia", "Brazil", "Colombia",
"Dominican Rep.", "El Salvador", "Guatemala", "Guyana", "Haiti",
"Honduras", "Nicaragua", "Paraguay", "Peru", "Suriname"), class =
"factor"),
mu = c(11.4216795790532, 11.336249852927, 11.2841715916567,
11.2112464680493, 11.1163747056146, 11.0042010015542, 10.8814601111044,
10.7555483953614, 10.6326412246687, 10.5168465177670), sigma =
c(0.101487190832973,
0.105383747354763, 0.107059434066487, 0.108387198864101,
0.109530496229634, 0.110541869698550, 0.111444696116090,
0.112248590819971, 0.112951348056450, 0.113550216614654)), .Names =
c("age",
"country", "mu", "sigma"), row.names = c("1", "2", "3", "4",
"5", "6", "7", "8", "9", "10"), class = "data.frame")
write.matrix(Bolivia.selected.ms.lat.m, file="C:\\Documents and Settings\\Dohyedan\\My Documents\\bolivia.selected.ms.lat.m", sep=" ")
[[alternative HTML version deleted]]
______________________________________________ R-help at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.