Try this: mydf <- data.frame(s8v2=rnorm(10), s12v3=runif(10), s1a5=rnorm(10), s6v1=rnorm(10)) pos <- match(c('s8v2', 's1a5'), names(mydf)) mydf[,seq(pos[1], pos[2])]
On 21/02/2008, Werner Wernersen <[EMAIL PROTECTED]> wrote: > Thank you very much, Henrique! The comment function is > exactly what I was looking for. > > Regarding 1) why example was bad: The column names > don't follow an easy pattern but are more like "s8v2", > "s12v3", "s6v1" etc. > > Kind regards, > Werner > > > --- Henrique Dallazuanna <[EMAIL PROTECTED]> schrieb: > > > > Try this: > > > > 1) > > mydf[1,paste("col", 4:8, sep="")] > > > > 2) You can use comment function: > > > > comment(mydf) <- c("Column number1", "Column > > number2") > > > > or > > > > comment(mydf$col1) <- "Column number1 etc" > > > > then > > > > comment(mydf) and comment(mydf$col1) to see the > > labels > > > > > > > > > __________________________________ Ihre erste Baustelle? > Wissenswertes für Bastler und Hobby Handwerker. www.yahoo.de/clever > > -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40" S 49° 16' 22" O ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.