?match ?pmatch On Wed, 12 Nov 2003 [EMAIL PROTECTED] wrote:
> I have a data frame (df) with colums x, y and z. > e.g. df <- data.frame(x = sample(4), y = sample(4), z = sample(4)) > I can extract column z by: df$z or df[3] > I can also extract columns x,y by: df[1:2] or by df[-3]. > > Is it possible to extract x,y columns in a "symbolic" fashion i.e. > by equivalent of df[-z] (which is illegal) ??? df[-match("z", names(df))] df[!(names(df) %in% "z")] etc -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595 ______________________________________________ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help