Hi, 

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of michele lux
Sent: Dienstag, 14. September 2004 10:44
To: [EMAIL PROTECTED]
Subject: [R] erase columns

Can somebody remember me which is the command to erase
columns from a data frame?
Thanks Michele

I hope the following code-piece helps what you are looking for:

mydf <- as.data.frame(matrix(runif(100),ncol=5))

### if you want to erase the third column, do:
mydf <- mydf[,-3]


mydf2 <- as.data.frame(matrix(runif(100),ncol=20))

### if you want to erase the first, third and twentieth column, do:
mydf2 <- mydf2[,-c(1,5,20)]

Ciao,
Roland


+++++
This mail has been sent through the MPI for Demographic Rese...{{dropped}}

______________________________________________
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Reply via email to