In S-Plus, data frames have slots as @title and @documentation. It seems that R is different. After the following code: vMatrix<-sqlQuery(sqlMatrix,sqlStr1) 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. Thanks.
Slots as @title and @documentation in S-Plus
3 messages · Wind, Martin Becker, Brian G. Peterson
You may use attributes, e.g. attr(vMatrix,"title") <- "The first time and so on." attr(vMatrix,"title") (see ?attr for details, especially for the list of "reserved" attribute names). Martin
Wind wrote:
In S-Plus, data frames have slots as @title and @documentation. It seems that R is different. After the following code: vMatrix<-sqlQuery(sqlMatrix,sqlStr1) 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. Thanks.
_______________________________________________ R-SIG-Finance at stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-finance -- Subscriber-posting only. -- If you want to post, subscribe first.
Dr. Martin Becker Statistics and Econometrics Saarland University Campus C3 1, Room 206 66123 Saarbruecken Germany
Wind wrote:
In S-Plus, data frames have slots as @title and @documentation. It seems that R is different. After the following code: vMatrix<-sqlQuery(sqlMatrix,sqlStr1) 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. Thanks.
First of all, this question belonged on r-help, not r-sig-finance, since it has
nothing to do with finance, and you'd be likely to get better and faster
answers from the much larger community there.
Next, see ?list, or better yet, use xts for your time series data, since it
already has a convenient way to add whatever arbitrary attributes you want.
Regards,
- Brian
Brian G. Peterson http://braverock.com/brian/ Ph: 773-459-4973 IM: bgpbraverock