[R] S4 class questions

From: Li, Xuejun <XueLi_at_coh.org>
Date: Thu, 10 Jul 2008 08:45:16 -0700


Hi, I'd like to create a S4 class contains only one type of data. However, the number of slots varies.  

For example, I want to create a class "a", each slots in "a" contains numeric value only.  

> setClass("a", contains = "numeric")

If I want to create an object "a" with only one slot containing c(3,4), I will write  

> new("a", c(3,4))

What if I want to create another object "a" with three slots with c(3,4) in the 1st slot, c(1,2) in the second, and c(0, 5) in the third?        

Arthur Xuejun Li

Division of Information Science

1500 East Duarte Road

Duarte, CA 91010 - 3000

Ph: (626) 256-4673 ext. 65121

Fax: (626) 471-7106  

SECURITY/CONFIDENTIALITY WARNING: \ This message an...{{dropped:23}}

R-help_at_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. Received on Thu 10 Jul 2008 - 15:49:50 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 10 Jul 2008 - 17:31:14 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive