On Wed, 2005-10-12 at 14:31 +0200, Jan Conrad wrote:
> Hi R,
> I have a seemingly simple problem. I have a table in following format
> (tab seperated)
>
> Njets NBjets NElec NMuon Meff HT HT3j HE Aplan
> Plan
> 1 4 3 2 0 366.278 253.642 87.7473 1385
> 0.0124566 0.376712
> 2 3 1 1 0 235.19 157.688 18.2852
> 574.253 0.00064187 0.00528814
>
> I read in with:
>
> > ttbar<-read.table("test2.dat",header=TRUE)
>
>
> > ttbar
> Njets NBjets NElec NMuon Meff HT HT3j HE Aplan
> 1 4 3 2 0 366.278 253.642 87.7473 1385.000 0.01245660
> 2 3 1 1 0 235.190 157.688 18.2852 574.253 0.00064187
> Plan
> 1 0.37671200
> 2 0.00528814,
>
> i.e.. the table is split after 9 variables. How come ?
>
> Thanks,
> Jan
As per ?read.table, the default delimiter is 'sep = ""', which is any
"whitespace".
Hence, if your file is tab delimited, you need to modify your call to:
ttbar <- read.table("test2.dat", header = TRUE, sep = "\t")
HTH,
Marc Schwartz
______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html