Re: [R] how to add a row vector in a dataframe

2013-04-15 Thread arun
Hi, May be this helps you. #Using set.seed(12345) S=10 simdata <- replicate(S, generate(250)) lstpshat<-lapply(seq_len(ncol(simdata)),function(i) {glm.t<-glm(t~x1+x2+x3+x4+x5+x6+x7+I(x2^2)+I(x4^2)+I(x7^2)+x1:x3+x2:x4+x3:x5+x4:x6+x5:x7+x1:x6+x2:x3+x3:x4+x4:x5+x5:x6,family=binomial,data=simdata[

Re: [R] how to add a row vector in a dataframe

2013-04-13 Thread arun
Hi, Using S=1000 and simdata <- replicate(S, generate(3000)) #If you want both "m1" and "m0" #here the missing values are 0 res1<-sapply(seq_len(ncol(simdata.psm1)),function(i) {x1<-merge(simdata.psm0[,i],simdata.psm1[,i],all=TRUE); x1[is.na(x1)]<-0; x1}) res1[,997:1000] #  [,1] [,