[R] How to get the name of the first argument in an assignment function?

Heinz Tuechler tuechler at gmx.at
Thu Jul 27 11:42:50 CEST 2006


Dear All!

If I pass an object to an assignment function I cannot get it's name by 
deparse(substitute(argument)), but I get *tmp* and I found no way to get
the original name, in the example below it should be "va1".
Is there a way?

Thanks,

Heinz

## example
'fu1<-' <- function(var, value) {
print(c(name.of.var=deparse(substitute(var))))}
fu1(va1) <- 3

name.of.var 
    "*tmp*" 

## desired result:
## name.of.var 
##    "va1" 



version
               _                                        
platform       i386-pc-mingw32                          
arch           i386                                     
os             mingw32                                  
system         i386, mingw32                            
status         Patched                                  
major          2                                        
minor          3.1                                      
year           2006                                     
month          07                                       
day            23                                       
svn rev        38687                                    
language       R                                        
version.string Version 2.3.1 Patched (2006-07-23 r38687)



More information about the R-help mailing list