I hadn't seen 'comment' before, so don't take my suggestion as authoritative. It looks useful, so I investigated a bit.
This technique seems to work and is (perhaps?) easier than names: tlist <- list(a=c(1:3), b=7) comment(x) <- unlist(sapply(tlist, as.character)) or in one line comment(x) <- unlist(sapply(list(a=c(1:3), b=7), as.character)) If at least one of the list elements is already character you could simplify to: tlist <- list(a=c(1:3), b="fred") comment(x) <- unlist(tlist) or in one line comment(x) <- unlist(list(a=c(1:3), b="fred")) Not as nice as having a _real_ list, but I guess that would really be a case for attributes HTH Keith J "Tal Galili" <tal.gal...@gmail.com> wrote in message news:aanlktimpmma9_h1+=oj1bhrf27rlp2j5veodhjxqp...@mail.gmail.com... > Hello all, > > I recently discovered the "comment" command. > I see it can only hold a vector of characters. > > Is there a way (or an alternative), to make it possible to have it keep a > list? > (for example, to keep different pieces of information like date of > creation, > information of each variable and so on) > > The closest solution I can think of is using 'names' on the vector, like > this: > x <- 1 > comment(x) <- letters > names(comment(x)) <- LETTERS > x > comment(x) > > > Any other suggestions? > (or general best practices for the "comment" command ?) > > Thanks, > Tal > > ----------------Contact > Details:------------------------------------------------------- > Contact me: tal.gal...@gmail.com | 972-52-7275845 > Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) | > www.r-statistics.com (English) > ---------------------------------------------------------------------------------------------- > > [[alternative HTML version deleted]] > ______________________________________________ R-help@r-project.org 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.