[R] Need Help using the OO package
Aditya Udas
adiudas at gmail.com
Fri Oct 24 22:44:51 CEST 2008
Hi Henrik,
It would be great if you could help me out with my following problem.
I am trying to create a class like :
setConstructorS3("MyPTCM",function(tokenslist=0)
{
extend(Object(), "MyPTCM",
.gamma = 0.0,
.rho = 0.0,
.phi = 0.0,
.tokenslist = tokenslist,
.uniquetokens = unique(tokenslist),
.numtypes = length(uniquetokens),
.Nsq = numtypes*numtypes,
.CONTEXTti = array(0,dim=numtypes),
.CONTEXTtim = array(0,dim=numtypes),
.ZEROVEC = .CONTEXTti,
.MTF = array(0.0,dim=c(numtypes,numtypes)),
.hIN = array(0.0,dim=c(numtypes,numtypes)),
.tokencount <- 0);
}
)
Everytime I try to create an object of type MyPTCM, it gives me an error saying
> b <- MyPTCM(tokens)
Error in extend.Object(Object(), "MyPTCM", gamma = 0, rho = 0, phi = 0, :
object "uniquetokens" not found
I have tried using this$.uniquetokens and just by referencing it with
.uniquetokens and other such techniques but to no avail.
I'm sure I'm making some basic fundamental mistake.
Any kind of inputs would be greatly appreciated.
Thanks in Advance,
Aditya
More information about the R-help
mailing list