[R] RC class composition

Mohan.Radhakrishnan at cognizant.com Mohan.Radhakrishnan at cognizant.com
Mon May 22 12:12:48 CEST 2017


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 )

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]]

More information about the R-help mailing list