Re: [R] names not inherited in functions

2007-08-18 Thread david dav
Thank you to all. And thank you for the extra tips. I had a kind of feeling my "names(data.frame(var))" would seem awkward! David __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide htt

Re: [R] names not inherited in functions

2007-08-17 Thread Duncan Murdoch
On 8/17/2007 1:17 PM, david dav wrote: > Dear R list, > After a huge delay, I come back to this question. Using names of > variables inside a function is a problem I run into quite often. > Maybe this little example should help to get my point: > Suppose I want to make a function "llabel" to get th

Re: [R] names not inherited in functions

2007-08-17 Thread Gabor Grothendieck
Within a function deparse(substitute(x)) will give the name of x, as a character variable. Search the archives for deparse substitute to find many examples. On 8/17/07, david dav <[EMAIL PROTECTED]> wrote: > Dear R list, > After a huge delay, I come back to this question. Using names of > varia

Re: [R] names not inherited in functions

2007-08-17 Thread Charles C. Berry
David, I think you are looking for deparse(substitute(var)) See ?deparse Notice in ?data.frame this bit: ...: these arguments are of either the form 'value' or 'tag = value'. Component names are created based on the tag (if present) or T

Re: [R] names not inherited in functions

2007-08-17 Thread david dav
Dear R list, After a huge delay, I come back to this question. Using names of variables inside a function is a problem I run into quite often. Maybe this little example should help to get my point: Suppose I want to make a function "llabel" to get the labels of the variables from a data frame. If n

Re: [R] names not inherited in functions

2007-06-07 Thread Uwe Ligges
Not sure what you are going to get. Can you shorten your functions and specify some example data? Then please tell us what your expected result is. Best, Uwe Ligges david dav wrote: > Dear all, > > I 'd like to keep the names of variables when calling them in a function. > An example might h

[R] names not inherited in functions

2007-06-06 Thread david dav
Dear all, I 'd like to keep the names of variables when calling them in a function. An example might help to understand my problem : The following function puts in a new data frame counts and percent of a data.frame called as "tablo" the step " nom.chiffr[1] <- names(vari) " is useless as names f