Hey, I have an array with the dimensions 200x6x200 and I want to save it in a textfile. I want to be able to reload the text file to get the same array again: new.array<-load(mytextfile.txt) or something similar. I was not able to figure out a way to do that with write.table without having to save 200 text files. Is there another way? Thank you! Frauke -- View this message in context: http://r.789695.n4.nabble.com/export-3D-array-to-txt-file-tp4426005p4426005.html Sent from the R help mailing list archive at Nabble.com.
You can save it directly as an R object with save() and load with load() -- that's probably easiest. It should be portable between R platforms and sesions, but won't be easily accessible to other programs. Michael On Mon, Feb 27, 2012 at 3:45 PM, frauke <fhoss at andrew.cmu.edu> wrote:> Hey, > > I have an array with the dimensions 200x6x200 and I want to save it in a > textfile. I want to be able to reload the text file to get the same array > again: ? new.array<-load(mytextfile.txt) or something similar. I was not > able to figure out a way to do that with write.table without having to save > 200 text files. Is there another way? > > Thank you! > Frauke > > > > > > -- > View this message in context: http://r.789695.n4.nabble.com/export-3D-array-to-txt-file-tp4426005p4426005.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > 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.
why a text file? are you going to pass it to another program? 'load'/'save' has already been suggested. if you really want text, try 'dump'. Sent from my iPad On Feb 27, 2012, at 15:45, frauke <fhoss at andrew.cmu.edu> wrote:> Hey, > > I have an array with the dimensions 200x6x200 and I want to save it in a > textfile. I want to be able to reload the text file to get the same array > again: new.array<-load(mytextfile.txt) or something similar. I was not > able to figure out a way to do that with write.table without having to save > 200 text files. Is there another way? > > Thank you! > Frauke > > > > > > -- > View this message in context: http://r.789695.n4.nabble.com/export-3D-array-to-txt-file-tp4426005p4426005.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > 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.