[R] variable name of variable in dataframe

Tobias Verbeke tobias_verbeke at skynet.be
Fri Jul 25 12:16:07 CEST 2003

Dear list,

If I have this toy function:

toy <- function(b=.95){
toyframe <- data.frame(lion.95 = c(1, 2))

How can I obtain that for any value b, 
the name of the column becomes "lionb", 
i.e. lion.95 if b = .95, lion.85 if b = .85 etc.
knowing that .95 (.85 etc.) may also be
given as 0.95 (0.85 etc.) but that the
result should be lion.95 (lion.85 etc.) 

Thanks in advance,


More information about the R-help mailing list