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.


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 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 it into a
> matrix seperated by comma?
>
> Thanks
>
> PB
>
> __
> 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.
>



-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem you are trying to solve?

[[alternative HTML version deleted]]

__
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.


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 it into a
matrix seperated by comma?

Thanks

PB

__
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.


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
> "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 to do is read the file as text and
> then split it and read the bottom section where the 7 columns are.
> Then I would re-read the table with read.table.
> 
> Thank you for any help,
> 
> Paul

What's wrong with using read.csv? (Or have I misunderstood
your query?)

Ted.


E-Mail: (Ted Harding) 
Fax-to-email: +44 (0)870 094 0861
Date: 17-Feb-07 Time: 00:39:37
-- XFMail --

__
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.



-
 Here’s a new way to find what you're looking for - Yahoo! Answers 
[[alternative HTML version deleted]]

__
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.


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 
lines.

On Sat, 17 Feb 2007, Patrick Burns wrote:

> '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 think you would
> need to write a file and read it back in again.
>
>
> Patrick Burns
> [EMAIL PROTECTED]
> +44 (0)20 8525 0696
> http://www.burns-stat.com
> (home of S Poetry and "A Guide for the Unwilling S User")
>
>
> 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 open right with 7 columns.
>> What I would really like to do is read the file as text and then split
>> it and read the bottom section where the 7 columns are. Then I would
>> re-read the table with read.table.
>>
>>Thank you for any help,
>>
>>Paul
>>
>>
>>
>
> __
> 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.
>

-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
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.


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 think you would
need to write a file and read it back in again.


Patrick Burns
[EMAIL PROTECTED]
+44 (0)20 8525 0696
http://www.burns-stat.com
(home of S Poetry and "A Guide for the Unwilling S User")


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 open right with 7 columns.
>What I would really like to do is read the file as text and then split
>it and read the bottom section where the 7 columns are. Then I would
>re-read the table with read.table.
>
>Thank you for any help,
>
>Paul
>
>  
>

__
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.


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 open right with 7 columns.
> What I would really like to do is read the file as text and
> then split it and read the bottom section where the 7 columns are.
> Then I would re-read the table with read.table.
> 
> Thank you for any help,
> 
> Paul

What's wrong with using read.csv? (Or have I misunderstood
your query?)

Ted.


E-Mail: (Ted Harding) <[EMAIL PROTECTED]>
Fax-to-email: +44 (0)870 094 0861
Date: 17-Feb-07   Time: 00:39:37
-- XFMail --

__
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.


[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 to do is read the file as text and then split
it and read the bottom section where the 7 columns are. Then I would
re-read the table with read.table.

Thank you for any help,

Paul

-- 
Research Technician
Mass Spectrometry
   o The
  /
o Scripps
  \
   o Research
  /
o Institute

__
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.