Re: [R] column name handling and long labels

From: Henrique Dallazuanna <wwwhsd_at_gmail.com>
Date: Thu, 21 Feb 2008 09:13:38 -0300

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 <pensterfuzzer_at_yahoo.de> 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 <wwwhsd_at_gmail.com> 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_at_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.
Received on Thu 21 Feb 2008 - 12:17:58 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 21 Feb 2008 - 14:00:17 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive