[R-SIG-Finance] Slots as @title and @documentation in S-Plus
windspeedo at qq.com
Fri Dec 19 14:08:00 CET 2008
So R has two kinds of easy methods tag any variable: comment and attr.
I like both of them.
What a great R.
------------------ 原始邮件 ------------------
发件人: "Robert Sams"<robert at sanctumfi.com>;
发送时间: 2008年12月19日(星期五) 晚上7:39
收件人: "Martin Becker"<martin.becker at mx.uni-saarland.de>; "Wind"<windspeedo at qq.com>;
抄送: "r-sig-finance"<r-sig-finance at stat.math.ethz.ch>;
主题: RE: [R-SIG-Finance] Slots as @title and @documentation in S-Plus
Also see ?comment
> vMatrix <- matrix(1:10, ncol=2)
> comment(vMatrix) <- "The first time and so on."
 "The first time and so on."
From: r-sig-finance-bounces at stat.math.ethz.ch [mailto:r-sig-finance-bounces at stat.math.ethz.ch] On Behalf Of Martin Becker
Sent: 19 December 2008 08:02
Subject: Re: [R-SIG-Finance] Slots as @title and @documentation in S-Plus
You may use attributes, e.g.
attr(vMatrix,"title") <- "The first time and so on."
(see ?attr for details, especially for the list of "reserved" attribute names).
> In S-Plus, data frames have slots as @title and @documentation. It seems that R is different.
> After the following code:
> If I want to add some memo to vMatrix，it would be vMatrix at title="The first time and so on." in S-Plus.
> But in R, data frame has no slots.
> According to help and documentations, it seems that S4 class has slot. But data frame is not S4. The S4/S3 confused me since I am new to R.
> I wonder whether thers's easy way to attach some memo to a data frame, as in S-Plus.
> R-SIG-Finance at stat.math.ethz.ch mailing list
> -- Subscriber-posting only.
> -- If you want to post, subscribe first.
Dr. Martin Becker
Statistics and Econometrics
Campus C3 1, Room 206
More information about the R-SIG-Finance