Problem reading a CSV

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Problem reading a CSV

naw3
Hi,

I have a CSV file where each row has at least 20 columns and some rows have up
to 30 columns of data. When I use the command,

Pathways<-read.table('MetaCycSample3.csv',sep=',',header=FALSE,quote='"')

anything past the 21st column gets kicked down to a new row. How can I fix this?

Thanks,
-Nina

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: Problem reading a CSV

Doran, Harold
Why are you not using read.csv()?

> -----Original Message-----
> From: [hidden email]
> [mailto:[hidden email]] On Behalf Of [hidden email]
> Sent: Monday, June 30, 2008 2:17 PM
> To: [hidden email]
> Subject: [R] Problem reading a CSV
>
> Hi,
>
> I have a CSV file where each row has at least 20 columns and
> some rows have up to 30 columns of data. When I use the command,
>
> Pathways<-read.table('MetaCycSample3.csv',sep=',',header=FALSE
> ,quote='"')
>
> anything past the 21st column gets kicked down to a new row.
> How can I fix this?
>
> Thanks,
> -Nina
>
> ______________________________________________
> [hidden email] 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.
>

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: Problem reading a CSV

ssefick
In reply to this post by naw3
does it really getting kicked down to another row or is this just an
artifact of printing in the command window?

On Mon, Jun 30, 2008 at 2:16 PM, <[hidden email]> wrote:

> Hi,
>
> I have a CSV file where each row has at least 20 columns and some rows have
> up
> to 30 columns of data. When I use the command,
>
> Pathways<-read.table('MetaCycSample3.csv',sep=',',header=FALSE,quote='"')
>
> anything past the 21st column gets kicked down to a new row. How can I fix
> this?
>
> Thanks,
> -Nina
>
> ______________________________________________
> [hidden email] 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.
>



--
Let's not spend our time and resources thinking about things that are so
little or so large that all they really do for us is puff us up and make us
feel like gods. We are mammals, and have not exhausted the annoying little
problems of being mammals.

-K. Mullis

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: Problem reading a CSV

Paulo Barata
In reply to this post by naw3

Nina,

In which way have you obtained your CSV file? Did you export data
from an Excel spreadsheet?

Regards,

Paulo Barata

-----------------------------------------------------------------------
Paulo Barata
Fundacao Oswaldo Cruz
Rua Leopoldo Bulhoes 1480 - 8A
21041-210  Rio de Janeiro - RJ
Brazil

E-mail: [hidden email]
Alternative e-mail: [hidden email]
-----------------------------------------------------------------------

 >Message: 48
 >Date: Mon, 30 Jun 2008 14:16:58 -0400
 >From: [hidden email]
 >Subject: [R] Problem reading a CSV
 >To: [hidden email]
 >Message-ID: <[hidden email]>
 >Content-Type: text/plain; charset=ISO-8859-1
 >
 >
 >Hi,
 >
 >I have a CSV file where each row has at least 20 columns and some >rows
 >have up to 30 columns of data. When I use the command,
 >
 >Pathways<-read.table('MetaCycSample3.csv',sep=',',header=FALSE,quote='"')
 >
 >anything past the 21st column gets kicked down to a new row. How can >I
 >fix this?
 >
 >Thanks,
 >-Nina

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: Problem reading a CSV

Jim Porzak
In reply to this post by naw3
Nina,

read.csv() will default fill = TRUE,
or add to your read.table() argument list.

If that does not help, you will need to use col.names argument. see
?read.table

HTH,
Jim Porzak
Responsys, Inc.
San Francisco, CA
http://www.linkedin.com/in/jimporzak

On Mon, Jun 30, 2008 at 11:16 AM, <[hidden email]> wrote:

> Hi,
>
> I have a CSV file where each row has at least 20 columns and some rows have
> up
> to 30 columns of data. When I use the command,
>
> Pathways<-read.table('MetaCycSample3.csv',sep=',',header=FALSE,quote='"')
>
> anything past the 21st column gets kicked down to a new row. How can I fix
> this?
>
> Thanks,
> -Nina
>
> ______________________________________________
> [hidden email] 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.
>

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] 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.