[R] Accessing data

TEMPL Matthias Matthias.Templ at statistik.gv.at
Mon May 17 10:46:58 CEST 2004


Hello,

I would like to access my data frame without one variable. 

E.g.:
> colnames(x)
[1] "Besch"  "Ang.m"  "Arb.m"  "i10"    "Umsatz" "arbstd"

I can try x[,-1], but this variable must be called by it´s name.

x[,-"Besch"]
x[,!"Besch"]
attach(x)
x[-Besch]
...
...
does not work.


I could not found a solution of this little problem in any scripts about R and in google.

Should I type in   x[,c("Ang.m","Arb.m","i10","Umsatz","arbstd")] to access my data frame without variable "Besch", or is there any better solution.

Some of my data frames has ~100 variables and so is x[,c(...)] a little bit exhausting.

Thanks for any help,

Matthias




More information about the R-help mailing list