Colleagues,
Hopefully a simple problem: I want to delete a column with a known
name from a dataframe. I could write:
FRAME - FRAME[, names(FRAME) != NAMETODELETE]
or
FRAME - FRAME[, !names(FRAME) %in% c(NAME1, NAME2, ETC)]
Is there some simpler means to accomplish this?
Try this:
FRAME$NAMETODELETE - NULL
On Tue, Sep 29, 2009 at 5:12 PM, Dennis Fisher fis...@plessthan.com wrote:
Colleagues,
Hopefully a simple problem: I want to delete a column with a known name from
a dataframe. I could write:
FRAME - FRAME[, names(FRAME) != NAMETODELETE]
or
May be this:
FRAME - FRAME[-c(NAME1, NAME2)]
or
FRAME- subset(FRAME, select=(-NAME1, -NAME2))
bests
milton
On Tue, Sep 29, 2009 at 4:12 PM, Dennis Fisher fis...@plessthan.com wrote:
Colleagues,
Hopefully a simple problem: I want to delete a column with a known name
from a dataframe. I
On 30/09/2009, at 9:15 AM, milton ruser wrote:
May be this:
FRAME - FRAME[-c(NAME1, NAME2)]
or
FRAME- subset(FRAME, select=(-NAME1, -NAME2))
This is ridiculous advice. Try things out before you suggest them.
cheers,
Rolf Turner
x=runif(12)
y=runif(12)
w=runif(12)
mydf-data.frame(cbind(x,y,w))
head(mydf)
mydf-subset(mydf, select=c(-x,-w))
head(mydf)
On Tue, Sep 29, 2009 at 4:27 PM, Rolf Turner r.tur...@auckland.ac.nzwrote:
On 30/09/2009, at 9:15 AM, milton ruser wrote:
May be this:
FRAME - FRAME[-c(NAME1,
On 30/09/2009, at 9:32 AM, milton ruser wrote:
x=runif(12)
y=runif(12)
w=runif(12)
mydf-data.frame(cbind(x,y,w))
head(mydf)
mydf-subset(mydf, select=c(-x,-w))
head(mydf)
But this doesn't work if NAME1 and NAME2 are ***names***,
as the terminology would apply. And that is
Peace on your heart... it is still Tuesday, and Friday is away... :-)
On Tue, Sep 29, 2009 at 4:54 PM, Rolf Turner r.tur...@auckland.ac.nzwrote:
On 30/09/2009, at 9:32 AM, milton ruser wrote:
x=runif(12)
y=runif(12)
w=runif(12)
mydf-data.frame(cbind(x,y,w))
head(mydf)
On 29/09/2009 4:54 PM, Rolf Turner wrote:
On 30/09/2009, at 9:32 AM, milton ruser wrote:
x=runif(12)
y=runif(12)
w=runif(12)
mydf-data.frame(cbind(x,y,w))
head(mydf)
mydf-subset(mydf, select=c(-x,-w))
head(mydf)
But this doesn't work if NAME1 and NAME2 are ***names***,
as
On 30/09/2009, at 10:25 AM, Duncan Murdoch wrote:
On 29/09/2009 4:54 PM, Rolf Turner wrote:
On 30/09/2009, at 9:32 AM, milton ruser wrote:
x=runif(12)
y=runif(12)
w=runif(12)
mydf-data.frame(cbind(x,y,w))
head(mydf)
mydf-subset(mydf, select=c(-x,-w))
head(mydf)
But this doesn't
What about using NULL?
x-runif(12)
y-runif(12)
z-runif(12)
mydf-data.frame(cbind(x,y,z))
names(mydf)
[1] x y z
mydf$x-NULL
names(mydf)
[1] y z
--- On Tue, 9/29/09, Rolf Turner r.tur...@auckland.ac.nz wrote:
From: Rolf Turner r.tur...@auckland.ac.nz
Subject: Re: [R] Deleting a column
10 matches
Mail list logo