[R] (no subject)

David Barron mothsailor at googlemail.com
Sat Nov 18 16:20:38 CET 2006


I'm not sure what the last line is trying to achieve, but this might
be what you want:

i <- ifelse(m==0, l/ky, l/ky + 1)
j <- ifelse(m==0,ky, l %% ky)


On 18/11/06, Céline Henzelin <celine_appui at hotmail.com> wrote:
> Hello,
>
> I need help to understand my error in this code... I would like to make a
> direct sampler...
>
> thanks
>
> Celine
>
>
> p<-matrix(c(1,2,3,2,1,4),3,2,byrow=T)
> p<-p/sum(p)
> ky<-ncol(p)
> kx<-nrow(p)
> p.vec<-as.vector(t(p))
> l<-rmultinom(1,1,p)
> l<-(t(l))
> m<-(l%%ky)
> ifelse (m==0, i<-l/ky && (j<-ky), i<-((l/ky)+1) &&  (j<-(l %% ky)
>
> _________________________________________________________________
> Faites de MSN Search votre page d'accueil: Toutes les réponses en un clic!
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>


-- 
=================================
David Barron
Said Business School
University of Oxford
Park End Street
Oxford OX1 1HP



More information about the R-help mailing list