Re: [R] column name handling and long labels

2008-02-27 Thread Frank E Harrell Jr
Werner Wernersen wrote: > Somehow, I don't get how the labels of Hmisc work. My > expectation was that if I use the following code and > then the print method, I would get an output where the > headers are replaced by the labels but I get the > normal variable names. How can I get the labels as > h

Re: [R] column name handling and long labels

2008-02-27 Thread Werner Wernersen
Somehow, I don't get how the labels of Hmisc work. My expectation was that if I use the following code and then the print method, I would get an output where the headers are replaced by the labels but I get the normal variable names. How can I get the labels as headers instead in the printed table?

Re: [R] column name handling and long labels

2008-02-21 Thread Werner Wernersen
That's perfect! The subset way is very easy to use and I have to play around a bit more with label() which seems quite complex. Thanks a million, Werner --- Gabor Grothendieck <[EMAIL PROTECTED]> schrieb: > On Thu, Feb 21, 2008 at 6:09 AM, Werner Wernersen > <[EMAIL PROTECTED]> wrote: > > Hi,

Re: [R] column name handling and long labels

2008-02-21 Thread Gabor Grothendieck
On Thu, Feb 21, 2008 at 6:09 AM, Werner Wernersen <[EMAIL PROTECTED]> wrote: > Hi, > > I have two loosely related questions which could make > my live again a bit easier: > > 1) Is there a simple way to select a range of columns > in a data frame using column names? > I am thinking of something lik

Re: [R] column name handling and long labels

2008-02-21 Thread Henrique Dallazuanna
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

Re: [R] column name handling and long labels

2008-02-21 Thread Werner Wernersen
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: >

Re: [R] column name handling and long labels

2008-02-21 Thread Henrique Dallazuanna
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 On 21/02/2008, Werner Wernersen <[EMAIL PROTECTED

[R] column name handling and long labels

2008-02-21 Thread Werner Wernersen
Hi, I have two loosely related questions which could make my live again a bit easier: 1) Is there a simple way to select a range of columns in a data frame using column names? I am thinking of something like mydf[1,"col4":"col8"] 2) I have a data frame with many columns and they all have short