s-news
[Top] [All Lists]

Re: [S] Summary: Remove column(s) from data frame?

To: parkhurs@indiana.edu (David Parkhurst)
Subject: Re: [S] Summary: Remove column(s) from data frame?
From: "Patrick Connolly" <P.Connolly@hort.cri.nz>
Date: Fri, 25 Jun 1999 08:59:14 +1200 (NZST)
Cc: s-news@wubios.wustl.edu (Snews)
In-reply-to: <003d01bebe47$a5718bb0$aa044f0c@1hk7i> from "David Parkhurst" at Jun 24, 99 08:42:44 am
Reply-to: "Patrick Connolly" <P.Connolly@hort.cri.nz>
Sender: owner-s-news@wubios.wustl.edu
According to David Parkhurst:
|> 
|> 
|> Thanks to the many! people who answered my query about removing columns
|> from a data frame.  (I couldn't track that down in the splus help
|> system, nor using the indices of a couple of books.)
|> 
|> I'll provide just a few responses, as they cover the gamut:
|> 
|> Bill Venables:
|> You can do it the same way that you remove columns from a matrix:
|> Suppose you want to remove columns 2, 3 & 4:
|> 
|> Dat <- Dat[, -(2:4)]  # comma and parens necessary...

In fact, the comma is not necessary if Dat is a data frame but it might
be advisable to be consistent with other procedures.

best

Patrick
-----------------------------------------------------------------------
This message was distributed by s-news@wubios.wustl.edu.  To unsubscribe
send e-mail to s-news-request@wubios.wustl.edu with the BODY of the
message:  unsubscribe s-news

<Prev in Thread] Current Thread [Next in Thread>