[R] Why a multi column, tab delimited file has only one column after reading in with read.table specification sep="\t"
Charles C. Berry
cberry at tajo.ucsd.edu
Mon May 21 00:33:53 CEST 2007
On Sun, 20 May 2007, Yong Wang wrote:
> Dear all:
> I have a tab delimited file as following
Probably you do NOT have a tab delimited file after all.
> AGE WEIGHT PROTEIN ........
> 6 20 3 ........
> 8 39 4 ........
> I tried to read it as following:
> data <- read.table(file,sep="\t",header=T);
table( count.fields( file ) )
table( count.fields( file, sep='\t' ) )
If the former gives the right number of fields, then you have white space
without tabs separating the data elements.
If they both tell you that you have only one filed in each line, your
lines quoted, perhaps.
Otherwise, can you "provide commented, minimal, self-contained,
reproducible code" as requested below to demonstrate this behavior??
> but there is only column for the data after reading in,:
>  200 1
> the column name is "AGE...WEIGHT...........PROTEIN...."
> Any quick suggestion will be appreciated.
> Best Regards
> R-help at stat.math.ethz.ch mailing list
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
Charles C. Berry (858) 534-2098
Dept of Family/Preventive Medicine
E mailto:cberry at tajo.ucsd.edu UC San Diego
http://biostat.ucsd.edu/~cberry/ La Jolla, San Diego 92093-0901
More information about the R-help