[R] Read.table question

Michael A. Miller mmiller3 at iupui.edu
Fri Sep 6 00:11:54 CEST 2002


>>>>> "Markus" == Markus Haag <markus_haag at gmx.at> writes:

    > i used the following command: a <- read.scv2("file.csv",
    > sep=";") so the import worked fine.  the problem is that
    > everything is stored in the variable a now i want to
    > extract each series (Date, AAA, AA) and store them into
    > their own variable. e.g. the values in the AAA column
    > should be stored into AAA any ideas on how this shoul be
    > done?  thanks in advance

You can get individual components of you data frame by name.  For
example, a$AAA gives you the AAA column.  AAA <- a$AAA gives you
a separate variable for the AAA column.

A simpler way is to use 'attach'.  If you give the command
attach(a), you will be able to access the columns by name,
without the 'a$' part.

Mike

P.S.  There is a nice introduction to this and more at
http://cran.r-project.org/manuals.html.
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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