[Rd] Extract method for a new class
Coster, Albart
Albart.Coster at wur.nl
Fri Sep 19 16:59:30 CEST 2008
Dear list,
I am trying to write a package for simulating meioses in R. We defined a class 'haplotype' which contains the basic units of our simulation:
setClass("haplotype",representation(snp = "numeric",qtl = "list",
hID = "numeric",phID0 = "numeric",phID1 = "numeric"),
prototype = list(hID = 0,phID0 = NaN,phID1 = NaN))
In addition, we define a class 'haploList', which is just a list of haplotypes:
setClass("haploList",contains = "list",representation(genDist = "numeric",roundDec = "integer"))
Most things work fine, but when subsetting a haploList object an object of class list is returned. I realize that I need to write a function for subsetting this new object, and tried to find the code for '[.listof' or something similar could not find it, probably due to a suboptimal understanding of how it is organized.
My question is, how could I define a extraction function for my new class that uses all the existing functionality of the Extract function for list?
Thanks in advance,
Albart Coster
More information about the R-devel
mailing list