

   SSuubbsseettttiinngg vveeccttoorrss aanndd ddaattaa ffrraammeess

        subset(x, ...)

   AArrgguummeennttss::

          x: Object to be subsetted

        ...: How to subset, depends on object

     subset: logical expression

     select: expression, indicating variables to select from a
             dataframe

   DDeessccrriippttiioonn::

        For ordinary vectors, the result is simply

        `x[subset&!is.na(subset)]'.

        For dataframes, the `subset' argument works similarly
        on the rows.  Note that `subset' will be evaluated in
        the dataframe.

        The  `select' argument exists only for dataframes. It
        works by first replacing variable names in the selec-
        tion expression with the corresponding column numbers
        in the dataframe and then using the resulting integer
        vector to index the columns. This allows the use of the
        standard indexing conventions so that e.g. ranges of
        variables can be specified easily.

   VVaalluuee::

        Selected rows and columns of the object `x'

   AAuutthhoorr((ss))::

        Peter Dalgaard

   SSeeee AAllssoo::

        `"["', `transform'

   EExxaammpplleess::

        data(airquality)
        subset(airquality,Temp>80,select=c(Ozone,Temp))
        subset(airquality,Day==1,select=-Temp)
        subset(airquality,select=Ozone:Wind)

        attach(airquality)
        subset(Ozone,Temp>80)

