[R] Removing variables from data frame with a wile card
@tyen @end|ng |rom ntu@edu@tw
Mon Feb 13 03:38:00 CET 2023
x[“V2”] would retain columns of x headed by V2. What I need is the opposite——I need a data grime with those columns excluded.
Steven from iPhone
> On Feb 13, 2023, at 9:33 AM, Rolf Turner <r.turner using auckland.ac.nz> wrote:
>> On Sun, 12 Feb 2023 14:57:36 -0800
>> Jeff Newmiller <jdnewmil using dcn.davis.ca.us> wrote:
>> is more efficient than using drop=FALSE, and perfectly normal syntax
>> (data frames are lists of columns).
> I never cease to be amazed by the sagacity and perspicacity of the
> designers of R. I would have worried that x["V2"] would turn out to be
> a *list* (of length 1), but no, it retains the data.frame class, which
> is clearly the Right Thing To Do.
> Honorary Research Fellow
> Department of Statistics
> University of Auckland
> Stats. Dep't. phone: +64-9-373-7599 ext. 89622
> Home phone: +64-9-480-4619
[[alternative HTML version deleted]]
More information about the R-help