Re: [R] Geting names of variables

2008-03-22 Thread John Kane
I don't quite understand what you doing but have you looked at ?names ? x1 <- 3 x2 <- 5 y <- -34.5 mylist <- list(x1,x2,y) mynames <- c("First Trade Position", "Second Trade Position", "P&L") names(mylist) <- mynames mylist --- Fernando Saldanha <[EMAIL PROTECTED]> wrote: > I wanted to cr

[R] Geting names of variables

2008-03-22 Thread Fernando Saldanha
I wanted to create a list with the names of variables and their values. So I wrote the following function. add.to.list.names.vars.1 <- function(lnv, vnv) { i <- 1 while (i < length(vnv)) { z <- as.character(eval(substitute(quote(vnv[i+1])))[[2]][[i + 2]]) lnv[[vnv[i]]] <- list(Name = z