search for: demofn

Displaying 1 result from an estimated 1 matches for "demofn".

2005 Feb 08
5
How to get variable names in a function?
...c(7,7,4,4,2,1) table(bravo); table(charly) > table(bravo); table(charly) bravo 1 2 3 5 2 1 1 3 charly 1 2 4 7 1 1 2 2 The results are two tables with the names of the variables above each. If I want to do the same thing by a function I find no way to get the variable names above the tables. demofn<-function(varlist) {for (i in seq(along=varlist)) {cat(deparse(varlist[i])) # < - - - - how to change this? print(table(varlist[i]))}} > demofn(list(bravo, charly)) list(c(1, 1, 2, 3, 5, 5, 5)) 1 2 3 5 2 1 1 3 list(c(7, 7, 4, 4, 2, 1)) 1 2 4 7 1 1 2 2 > Thanks,...