[R] Accessing data

Petr Pikal petr.pikal at precheza.cz
Mon May 17 10:53:03 CEST 2004


Hi

On 17 May 2004 at 10:46, TEMPL Matthias wrote:

> 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[,names(x)!="Besch"]

should work but maybe there is some better solution

Cheers
Petr

> 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
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
> http://www.R-project.org/posting-guide.html

Petr Pikal
petr.pikal at precheza.cz




More information about the R-help mailing list