Dear All, I have to enter many lines of data in the same object. I usually use copy-paste to transfer data from an Word file to R. But, for large lines of data, R gets "confused" and gives an error message, i.e. it breaks one line somewhere, and lines get no meaning at all. Some times I solve that problem adding "enters" and making each line shorter, before I do copy-paste. Some times I add "spaces" in the word document, until R breaks each line (automatically adds a +) in any point where it still correct.. But it stills too "subjective" for me! :o\ What is the best way to do that? Regards, Sara Mouro [[alternative HTML version deleted]]
On 2/8/06 6:55 AM, "Sara Mouro" <sara at gmesintra.com> wrote:> Dear All, > > > > I have to enter many lines of data in the same object. > > I usually use copy-paste to transfer data from an Word file to R. > > But, for large lines of data, R gets "confused" and gives an error message, > i.e. it breaks one line somewhere, and lines get no meaning at all. > > > > Some times I solve that problem adding "enters" and making each line > shorter, before I do copy-paste. Some times I add "spaces" in the word > document, until R breaks each line (automatically adds a +) in any point > where it still correct.. > > But it stills too "subjective" for me! :o\ > > > > What is the best way to do that?I assume you mean that you are editing "code" and then pasting into R. If so, you might look into using one of several editors that "work with" R. Look in the mail archives for some of these. Sean
Sara Mouro wrote:> Dear All, > > > > I have to enter many lines of data in the same object. > > I usually use copy-paste to transfer data from an Word file to R. >> What is the best way to do that?Use 'Save As' to save your Word file - or rather just the data section - as a plain text or Ascii file. Then read into R with scan() or read.table() as appropriate. Barry
How does the data look and how are you storing in R (e.g. matrix, list)? I think this an issue related to Word where it is using either unequal spaces or different carriage returns. I would not recommend storing data, especially numerical ones in the form of a matrix, in Word files. I would recommend that you try to copy-and-paste into Excel first and clean it up there. Next save the file as tab delimited and use read.delim() in R. My experience is that that Excel seems understands the oddities of Word better than R does. Regards, Adai On Wed, 2006-02-08 at 11:55 +0000, Sara Mouro wrote:> Dear All, > > > > I have to enter many lines of data in the same object. > > I usually use copy-paste to transfer data from an Word file to R. > > But, for large lines of data, R gets "confused" and gives an error message, > i.e. it breaks one line somewhere, and lines get no meaning at all. > > > > Some times I solve that problem adding "enters" and making each line > shorter, before I do copy-paste. Some times I add "spaces" in the word > document, until R breaks each line (automatically adds a +) in any point > where it still correct.. > > But it stills too "subjective" for me! :o\ > > > > What is the best way to do that? > > > > > > Regards, > > Sara Mouro > > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html >