[R] RC class composition

Mohan.Radhakrishnan at cognizant.com
Mon, 22 May 2017 10:12:48 -0000

Hi,

The last line should give me the value of 'amount'. Is the syntax wrong
?

Measurement <- setRefClass("Measurement",
              fields = list(subject = Subject,
                                 quantity = Quantity))

s <- Subject$new(id = 100)

u <- CompoundUnit$new(  micrograms = 100,
                                      cubicmeter = 1 )

q <- Quantity$new(amount = 100,
                             units = u )

m <- Measurement$new(subject = s,
                                  quantity = q)
print( m$quantity$amount )

Thanks,
Mohan
This e-mail and any files transmitted with it are for the sole use of the
intended recipient(s) and may contain confidential and privileged information.
If you are not the intended recipient(s), please reply to the sender and destroy
all copies of the original message. Any unauthorized review, use, disclosure,
dissemination, forwarding, printing or copying of this email, and/or any action
taken in reliance on the contents of this e-mail is strictly prohibited and may
be unlawful. Where permitted by applicable law, this e-mail and other e-mail
communications sent to and from Cognizant e-mail addresses may be monitored.

	[[alternative HTML version deleted]]