[R] Operating on RC in a list
Mohan.Radhakrishnan at cognizant.com
Mohan.Radhakrishnan at cognizant.com
Wed Jun 7 10:35:07 CEST 2017
Hi,
I have a hierarchy of such classes. Subject has a list of measurements. Let assume I have a list of such 'Subject' RC's.
Can I use dplyr to navigate from Subject to the list of measurement RC's and filter and group data ? dplyr should
be able to call the methods on these RC's to operate on the data structure ?
I tried to coerce the list of RC's into a data frame unsuccessfully. But dplyr should be able to work with lists too. Right ?
Subject <- setRefClass("Subject",
fields = list( id = "numeric",
measurement = "Measurement",
location = "Location"),
methods=list(getmeasurement = function()
{
measurement
},
getid = function()
{
id
},
getlocation = function()
{
location
},
summary = function()#Implement other summary methods in appropriate objects as per their responsibilities
{
paste("Subject summary ID [",id,"] Location [",location$summary(),"]")
},show = function(){
cat("Subject summary ID [",id,"] Location [",location$summary(),"]\n")
})
)
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]]
More information about the R-help
mailing list