[R] reading text file not table

2007-02-16 Thread H. Paul Benton
Hello all, I'm looking for a way to be able to read a text file into R. It's a csv file but when I do "txt <-read.table("F00.csv", header=T, sep=",")" It doesn't read the file properly, and I only get 2 columns. If I open it up in OOc or Excel it open right with 7 columns. What I would really like

Re: [R] reading text file not table

2007-02-16 Thread Ted Harding
On 17-Feb-07 H. Paul Benton wrote: > Hello all, > > I'm looking for a way to be able to read a text file into R. > It's a csv file but when I do > "txt <-read.table("F00.csv", header=T, sep=",")" > It doesn't read the file properly, and I only get 2 columns. > If I open it up in OOc or Excel it op

Re: [R] reading text file not table

2007-02-17 Thread Patrick Burns
'count.fields' is often useful in such situations to see how R's view of the file differs from your own. (It isn't such a rare occurrence for differences to happen when the file comes from Excel.) If I understand properly, you can use sep='\n' as part of your alternative plan. But I don't thin

Re: [R] reading text file not table

2007-02-17 Thread Prof Brian Ripley
I think he is missing fill=TRUE, which is the default for read.csv but not read.table. (As Ted Harding implied but as I recall did not spell out.) If you want to read a file as text, used readLines. You can then extract the lines you want and use read.table on a textConnection from just those

Re: [R] reading text file not table

2007-02-21 Thread nalluri pratap
Hi, You can read a CSV file using the following way MyData<-read.csv(file.choose()) Regards, Pratap [EMAIL PROTECTED] wrote: On 17-Feb-07 H. Paul Benton wrote: > Hello all, > > I'm looking for a way to be able to read a text file into R. > It's a csv file but when I do > "tx

Re: [R] reading text file not table

2007-03-02 Thread H. Paul Benton
Sorry just one more question, Patrick Burns wrote: > > as part of your alternative plan. But I don't think you would > need to write a file and read it back in again. Yea So I tried to use the connection but that doesn't work. How can I read the object back in with read.csv, or at very least get

Re: [R] reading text file not table

2007-03-02 Thread jim holtman
Is this what you want to do? > x <- "1,2,3,4 + 5,6,7,8 + 9,0,1,2 + 3,4,5,6" > read.csv(textConnection(x), header=FALSE) V1 V2 V3 V4 1 1 2 3 4 2 5 6 7 8 3 9 0 1 2 4 3 4 5 6 On 3/2/07, H. Paul Benton <[EMAIL PROTECTED]> wrote: > > Sorry just one more question, > > Patrick Burns

Re: [R] reading text file not table

2007-03-02 Thread H. Paul Benton
__ R-help@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 and provide commented, minimal, self-contained, reproducible code.