I am sorry to ask such question, but I can't find a solution...

I have a dataframe 'd2004' and I want to remove two columns:
'd2004$concentration' and 'd2004$stade".

I could do it just as follows:

> names(d2004)

 [1] "Localite"       "Date"           "parcelle"       "maille"
"presence.plant" "concentration"  "stade.culture"
 [8] "stade"          "Trou"           "Horizon"        "Profondeur"

> d2004 <- d2004[, -c(6, 8)]

but I'd like to use column names (to avoid finding column numbers each
time).

I cannot find an easy way to operate...

I wonder why that works:
> d2004[, "concentration"]

and this don't:
> d2004 <- d2004[, -c("concentration", "stade")]

Thanks...

Jacques VESLOT / CIRAD

______________________________________________
[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