[R] reading in ASCII files

Mark Myatt mark at myatt.demon.co.uk
Tue Sep 25 11:05:49 CEST 2001

Johann Petrak <johann at ai.univie.ac.at> writes:
>I wonder if there is a way to read in CSV files so that
>- certain fields within each record (line) are ignored, i.e.
>   not converted to columns in the output data frame

You could write a bespoke function to do this using scan(). An internal
function or extension to read.table() might be useful but you can always
do that with whatever data-management tools you already use ... I use
EpiData (which allows you to drop variables when exporting to ASCII) and
DBMS/COPY which allows you to drop and recode during data transfer

>- factors/levels are created automatically: often, the possible
>   labels are known in advance and could immediately be
>   converted. This would save a lot of memory and time for
>   bigger files, I assume.

You can use levels() and factor() to do this.


Mark Myatt

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

More information about the R-help mailing list