[R] strange read.table results

Sarah Goslee sarah.goslee at gmail.com
Tue Nov 17 17:57:39 CET 2009


My guess is that there's something wrong with your file. You really don't
give us enough information to diagnose the problem, though. An encoding
issue? If you open the file in a plain text editor, what happens? What OS
are you using? Version of R?

When I copy your sample data from the email into a text file, deleting the
blank lines, it opens as expected using read.table() with no additiona
arguments.

Sarah

On Tue, Nov 17, 2009 at 9:43 AM, Daniel Alcock <da2 at sanger.ac.uk> wrote:
> Hi I hope someone can shed some light on this:
>
>
>
> For some reason when I
>
>
>
> read.table("bfx.txt")
>
>
>
> R decides to only give back the first character from each column in each row as one single column.
>
>
>
> Like this:
>
>
>
>    V1
>
> 1   яюr
>
> 2    \n
>
> 3     r
>
> 4     1
>
> 5     0
>
> 6     A
>
> 7     G
>
> 8    \n
>
> 9     r
>
> 10    1
>
> 11    0
>
> 12    T
>
> 13    C
>
> 14   \n
>
>
>
> The data should be:
>
>
>
> rs153410928 153410928 0.98802328 A G
>
> rs153411383 153411383 0.988026211 G A
>
> rs153411809 153411809 0.988028954 A G
>
> rs153411854 153411854 0.988029244 A G
>
> rs153413052 153413052 0.988036959 T C
>
>
>
> so not only is it screwing the data it's also missing the first 3 lines. Is this something I've done? I've tried dos2unix to make sure the files are ok, added colClasses="character", sep=" " etc but with no success.
>
>
>
> I'm just about at the end of my tether right now so any help will be gratefully received!
>
>
>
> Dan
>
>


-- 
Sarah Goslee
http://www.functionaldiversity.org




More information about the R-help mailing list