OMG. I think it uses comment character # as default in the argument.
comment.char = "#" How do I turn it off? On Mon, Mar 26, 2012 at 11:56 AM, Berend Hasselman <b...@xs4all.nl> wrote: > > On 26-03-2012, at 08:16, Ashish Agarwal wrote: > > > Why does the output in the following say 2 and not 6? > > > >> count.fields(textConnection("LL1532Ap,ABC# Depot-A+,,1971,8,2 > > + LL1532Ap,ABC# Depot-A+,Bhutan,1971,6,1 > > + LL1532Ap,ABC# Depot-A+,China,1971,17,1 > > + LL1532Ap,ABC# Depot-A+,China,1971,33,1 > > + LL1532Ap,ABC# Depot-A+,HongKong,1971,16,2 > > + LL1532Ap,ABC# Depot-A+,HongKong,1971,17,1 > > + LL1532Ap,ABC# Depot-A+,HongKong,1971,22,1 > > + LL1532Ap,ABC# Depot-A+,HongKong,1971,49,1 > > + LL1532Ap,ABC# Depot-A+,Kazakhstan,1971,20,1 > > + LL1532Ap,ABC# Depot-A+,Kazakhstan,1971,27,1 > > + LL1532Ap,ABC# Depot-A+,Kazakhstan,1971,33,1 > > + LL1532Ap,ABC# Depot-A+,Kazakhstan,1973,15,1 > > + LL1532Ap,ABC# Depot-A+,Romania-Europe,1971,10,1 > > + LL1532Ap,ABC# Depot-A+,Romania-Europe,1973,4,1 > > + LL1532Ap,ABC# Depot-A+,Sanchez-America,1973,9,1 > > + LL1532An,ABC# Depot-A-,,1971,8,2"),sep=",") > > [1] 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 > >> > > > > > Have you done > > ?count.fields > > and read what it says about the argument "sep" and the default? > > So if a comma is the separator what value would you give sep? > > Berend > > > [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org 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.