[R] Is there a way to have 'comment' keep a list?

2010-11-09 Thread Tal Galili
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

Re: [R] Is there a way to have 'comment' keep a list?

2010-11-09 Thread Henrique Dallazuanna
You can use attributes: attributes(x) - list(CreateDate = Sys.time(), User = Sys.info()['user']) On Tue, Nov 9, 2010 at 8:36 AM, Tal Galili tal.gal...@gmail.com wrote: Hello all, I recently discovered the comment command. I see it can only hold a vector of characters. Is there a way (or

Re: [R] Is there a way to have 'comment' keep a list?

2010-11-09 Thread Mario Valle
Look at the help page, the example does exactly this by putting a two element vector of strings as comment. Hope it helps mario On 09-Nov-10 11:36, Tal Galili wrote: Hello all, I recently discovered the comment command. I see it can only hold a vector of

Re: [R] Is there a way to have 'comment' keep a list?

2010-11-09 Thread Keith Jewell
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