[R] Deleting a column in a dataframe by name

Rolf Turner r.turner at auckland.ac.nz
Tue Sep 29 22:54:30 CEST 2009


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 precisely the
	situation in which one would wish to apply this sort of
	technique.

		cheers,

			Rolf Turner

> On Tue, Sep 29, 2009 at 4:27 PM, Rolf Turner  
> <r.turner at auckland.ac.nz> wrote:
>
> 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
>
> ######################################################################
> Attention: This e-mail message is privileged and confidential. If  
> you are not the intended recipient please delete the message and  
> notify the sender. Any views or opinions presented are solely those  
> of the author.
>
> This e-mail has been scanned and cleared by MailMarshal  
> www.marshalsoftware.com
> ######################################################################
>


######################################################################
Attention:\ This e-mail message is privileged and confid...{{dropped:9}}




More information about the R-help mailing list