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

From: Heinz Tuechler <tuechler_at_gmx.at>
Date: Thu 27 Jul 2006 - 19:42:50 EST

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?



## example

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



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


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)

R-help@stat.math.ethz.ch 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 Jul 27 19:48:36 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Thu 27 Jul 2006 - 22:16:33 EST.

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