I know it is possible to use the character "#" to comment lines in script files. Is it possible to give an argument (just like skip) to the fuction read.table to avoid reading commented lines in data files. I want to use this function to read a table in a data file like this #------------------------------- x y z #my data begin here 1 2 3 12 3 4 1 0 1 # no comment !!! 2 3 5 #-------------------------------- Thanks in advance. -- Ould MOHAMED ABDALLAHI Mohamed Lemine || e-mail: mould at imag.fr Laboratoire de Modelisation et Calcul || Tel: +33 4 76 51 45 54 BP 53, 38041 Grenoble cedex 9 (France) || Fax: +33 4 76 63 12 63 ---------------------------------------------------------------------- -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
> Date: Fri, 24 Nov 2000 14:46:47 +0100 > From: LAM <Lemine-Mohamed.Ould-Mohamed-Abdallahi at imag.fr> > To: "r-help at stat.math.ethz.ch" <r-help at stat.math.ethz.ch> > Subject: [R] Comments in read.table > > I know it is possible to use the character "#" to comment lines in > script files.R-language file, yes> > Is it possible to give an argument (just like skip) to the fuction > read.table to avoid reading commented lines in data files.No.> I want to use this function to read a table in a data file like this > #------------------------------- > x y z > #my data begin here > 1 2 3 > 12 3 4 > 1 0 1 > # no comment !!! > 2 3 5 > #--------------------------------Pre-process them with e.g. Perl to remove the comment lines, or even with R itself (read in the lines, remove those starting with #, write them out to a temp file and call read.table on the temp file). -- Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272860 (secr) Oxford OX1 3TG, UK Fax: +44 1865 272595 -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Pr. B.D. Ripley Wrote :>Because skipping headers is much more commonly used. I've never in adecade of use of S seen a data file with comments in, except as a header. Sure. I agree with you. This functionality is quite strange in the context on statistical data processing!! -- Ould MOHAMED ABDALLAHI Mohamed Lemine || e-mail: mould at imag.fr Laboratoire de Modelisation et Calcul || Tel: +33 4 76 51 45 54 BP 53, 38041 Grenoble cedex 9 (France) || Fax: +33 4 76 63 12 63 ---------------------------------------------------------------------- -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._