[R] error: subscript out of bounds?
David Winsemius
dwinsemius at comcast.net
Tue Jun 15 03:19:50 CEST 2010
On Jun 14, 2010, at 6:48 PM, Yesha Patel wrote:
> Hi all,
>
> I want to get results for cox proportional hazards on SNP data. I'm
> trying
> to get HRs, CI's, & p-values for each individual SNP - this is
> represented
> by cov[,i]. When I run my code, I get the following error: subscript
> out of
> bounds. I don't know why I am getting this error.
>
> I have looked through the R logs, but nothing that has been previously
> suggested has helped so far. What am I doing wrong?
>
> DS3 = time variable, S3 = censor/event variable, cov = my dataset,
> which is
> in a data.frame format:
>
> *********************************************************
> CODE:
>
> test<-NULL
> bb=names(cov)
> col = dim(cov)[2]
> for(i in 19:col)
> {
> mod=coxph(Surv(cov$DS3,cov$S3)~cov[,i]+AGE+sex,data=cov)
> aa<-summary(mod)
# Consider:
test <-rbind( test, c( nrow(aa$coef), nrow(aa$conf.int) ) )
> #test<-rbind(test,c(bb[i],aa$coef[1,1],aa$coef[1,3],aa$coef[1,5],aa
> $conf.int
> #[1,1],aa$conf.int[1,3],aa$conf.int
> #[1,4],aa$coef[2,5],aa$coef[3,5],aa$coef[4,5]))
> }
#
c(min(test[ , 1] ), min(test[ ,2] ) )
> #write.table(test,"result.txt",quote=F)
# Compare to your indices.
>
>
> Thanks!
> -CC
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org 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 Winsemius, MD
West Hartford, CT
More information about the R-help
mailing list