title: Creating an S4 object with vector of objects as a slot
body: <p>I am trying to define an S4 class with a slot that is a vector containing objects from another S4 class.  I am able to create a slot with a vector of integers:</p>
  
  <pre><code>&gt; setClass("foo", slots=c(myInt = "vector"), prototype=list(myInt=vector("integer", 25)))
  &gt; new("foo")
  An object of class "foo"
  Slot "myInt":
  [1] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
  </code></pre>
  
  <p>When I try to use a vector of my own classes, though, I get an error:</p>
  
  <pre><code>&gt; setClass("DistributionConstraintObj",
  +          slots = c(p = "numeric", minSize = "integer", maxSize = "integer"))
  &gt; setClass("SampleSizeDistribution",
  +          slots = c(sampleSizeDistDictionary = "vector", numEntries = "integer", limitSampleSize = "integer"),
  +          prototype = list(sampleSizeDistDictionary = vector("DistributionConstraintObj", 25), numEntries = as.integer(0), limitSampleSize = as.integer(25)))
  Error in vector("DistributionConstraintObj", 25) : 
    vector: cannot make a vector of mode 'DistributionConstraintObj'.
  </code></pre>
  
  <p>I have also tried saying "class" and "class DistibutionConstraintObj" in the call to vector, with the same result.</p>
  
  <p>How do I create a vector that contains S4 objects?</p>
  
  <p>Thanks for your help.
  Barbara</p>