I have some data that I've trouble importing... A B C D E A 1232 0.565 B 2323 0.5656 0.5656 0.5656 C 2323 0.5656 D 2323 0.5656 E 2323 0.5656 F 2323 0.5656 G 2323 0.5656 G 2323 0.5656 0.5656 0.5656 When I input the data it seems to go like this: SampleID ItemB ItemC ItemD ItemE A 1232 0.565 B 2323 0.5656 0.5656 0.5656 C 2323 0.5656 D 2323 0.5656 E 2323 0.5656 F 2323 0.5656 G 2323 0.5656 G 2323 0.5656 0.5656 0.5656 with the last two columns (or the two columns with vast amounts of missing data which are usually the last two = see SampleB) wrapping around - is there away to prevent this? Thanks!
There are many ways to import data into R, and I don't know any of them that would do what you are describing. You really need to give us some reproducible code if we are to follow along with your problem. --------------------------------------------------------------------------- Jeff Newmiller The ..... ..... Go Live... DCN:<jdnewmil at dcn.davis.ca.us> Basics: ##.#. ##.#. Live Go... Live: OO#.. Dead: OO#.. Playing Research Engineer (Solar/Batteries O.O#. #.O#. with /Software/Embedded Controllers) .OO#. .OO#. rocks...1k --------------------------------------------------------------------------- Sent from my phone. Please excuse my brevity. On May 9, 2015 7:59:31 AM PDT, Kate Ignatius <kate.ignatius at gmail.com> wrote:>I have some data that I've trouble importing... > >A B C D E >A 1232 0.565 >B 2323 0.5656 0.5656 0.5656 >C 2323 0.5656 >D 2323 0.5656 >E 2323 0.5656 >F 2323 0.5656 >G 2323 0.5656 >G 2323 0.5656 0.5656 0.5656 > >When I input the data it seems to go like this: > >SampleID ItemB ItemC ItemD ItemE >A 1232 0.565 >B 2323 0.5656 >0.5656 0.5656 >C 2323 0.5656 >D 2323 0.5656 >E 2323 0.5656 >F 2323 0.5656 >G 2323 0.5656 >G 2323 0.5656 0.5656 0.5656 > >with the last two columns (or the two columns with vast amounts of >missing data which are usually the last two = see SampleB) wrapping >around - is there away to prevent this? > >Thanks! > >______________________________________________ >R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see >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.
Some indication of what you have tried would be useful. Assuming you are using read.table(), then the "fill" argument of read.table() might be what you need. If you look at the help for read.table you will find:>From ?read.table:fill: logical. If 'TRUE' then in case the rows have unequal length, blank fields are implicitly added. See 'Details'. -- Don MacQueen Lawrence Livermore National Laboratory 7000 East Ave., L-627 Livermore, CA 94550 925-423-1062 On 5/9/15, 7:59 AM, "Kate Ignatius" <kate.ignatius at gmail.com> wrote:>I have some data that I've trouble importing... > >A B C D E >A 1232 0.565 >B 2323 0.5656 0.5656 0.5656 >C 2323 0.5656 >D 2323 0.5656 >E 2323 0.5656 >F 2323 0.5656 >G 2323 0.5656 >G 2323 0.5656 0.5656 0.5656 > >When I input the data it seems to go like this: > >SampleID ItemB ItemC ItemD ItemE >A 1232 0.565 >B 2323 0.5656 >0.5656 0.5656 >C 2323 0.5656 >D 2323 0.5656 >E 2323 0.5656 >F 2323 0.5656 >G 2323 0.5656 >G 2323 0.5656 0.5656 0.5656 > >with the last two columns (or the two columns with vast amounts of >missing data which are usually the last two = see SampleB) wrapping >around - is there away to prevent this? > >Thanks! > >______________________________________________ >R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see >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.
I've tried colClasses="character", fill=T, as.is=T, header=F, sep="\t", read.csv; read.delim, read.csv2, read.delim2.... don't know what else to try. On Sat, May 9, 2015 at 11:13 AM, MacQueen, Don <macqueen1 at llnl.gov> wrote:> Some indication of what you have tried would be useful. Assuming you are > using read.table(), then the "fill" argument of read.table() might be what > you need. If you look at the help for read.table you will find: > > From ?read.table: > fill: logical. If 'TRUE' then in case the rows have unequal length, > blank fields are implicitly added. See 'Details'. > > > -- > Don MacQueen > > Lawrence Livermore National Laboratory > 7000 East Ave., L-627 > Livermore, CA 94550 > 925-423-1062 > > > > > > On 5/9/15, 7:59 AM, "Kate Ignatius" <kate.ignatius at gmail.com> wrote: > >>I have some data that I've trouble importing... >> >>A B C D E >>A 1232 0.565 >>B 2323 0.5656 0.5656 0.5656 >>C 2323 0.5656 >>D 2323 0.5656 >>E 2323 0.5656 >>F 2323 0.5656 >>G 2323 0.5656 >>G 2323 0.5656 0.5656 0.5656 >> >>When I input the data it seems to go like this: >> >>SampleID ItemB ItemC ItemD ItemE >>A 1232 0.565 >>B 2323 0.5656 >>0.5656 0.5656 >>C 2323 0.5656 >>D 2323 0.5656 >>E 2323 0.5656 >>F 2323 0.5656 >>G 2323 0.5656 >>G 2323 0.5656 0.5656 0.5656 >> >>with the last two columns (or the two columns with vast amounts of >>missing data which are usually the last two = see SampleB) wrapping >>around - is there away to prevent this? >> >>Thanks! >> >>______________________________________________ >>R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see >>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. >
I've tried many things: read.csv("data.frame.txt", header=F, fill=T,stringsAsFactors=FALSE, sep="\t", colClasses="character") read.csv2("data.frame.txt", fill=T,stringsAsFactors=FALSE, sep="\t", as.is=T, colClasses="character") also with read.delim/2 read.table("data.frame.txt", header=F, fill=T,stringsAsFactors=FALSE, sep="\t", colClasses="character") And a combination of various different options. On Sat, May 9, 2015 at 11:11 AM, Jeff Newmiller <jdnewmil at dcn.davis.ca.us> wrote:> There are many ways to import data into R, and I don't know any of them that would do what you are describing. You really need to give us some reproducible code if we are to follow along with your problem. > --------------------------------------------------------------------------- > Jeff Newmiller The ..... ..... Go Live... > DCN:<jdnewmil at dcn.davis.ca.us> Basics: ##.#. ##.#. Live Go... > Live: OO#.. Dead: OO#.. Playing > Research Engineer (Solar/Batteries O.O#. #.O#. with > /Software/Embedded Controllers) .OO#. .OO#. rocks...1k > --------------------------------------------------------------------------- > Sent from my phone. Please excuse my brevity. > > On May 9, 2015 7:59:31 AM PDT, Kate Ignatius <kate.ignatius at gmail.com> wrote: >>I have some data that I've trouble importing... >> >>A B C D E >>A 1232 0.565 >>B 2323 0.5656 0.5656 0.5656 >>C 2323 0.5656 >>D 2323 0.5656 >>E 2323 0.5656 >>F 2323 0.5656 >>G 2323 0.5656 >>G 2323 0.5656 0.5656 0.5656 >> >>When I input the data it seems to go like this: >> >>SampleID ItemB ItemC ItemD ItemE >>A 1232 0.565 >>B 2323 0.5656 >>0.5656 0.5656 >>C 2323 0.5656 >>D 2323 0.5656 >>E 2323 0.5656 >>F 2323 0.5656 >>G 2323 0.5656 >>G 2323 0.5656 0.5656 0.5656 >> >>with the last two columns (or the two columns with vast amounts of >>missing data which are usually the last two = see SampleB) wrapping >>around - is there away to prevent this? >> >>Thanks! >> >>______________________________________________ >>R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see >>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. >