[R] Problems in Constructing Two way Matrix

Berend Hasselman bhh at xs4all.nl
Wed Jun 19 09:43:06 CEST 2013


On 19-06-2013, at 09:30, Fazli Raziq <raziq_fazli at yahoo.com> wrote:

> Hello,
> 
> Where is the problem in this programming. I want two way matrix, but it gives problem.

What is the problem?
What are you expecting and what are you getting?

> The program is given below:
> 
> Thanks in advance.
> 
> Regards
> Fazli Raziq
> 
> 
> rep = 2
> genes = 5
> pred = c()
> iter   = array (dim = c(rep, pred))
> pred = array(dim = c(1, genes))
> m = c()
> l = 1
> w = 1
> for(m in 1:rep) {
> t = time
> c = cens
> tab = cbind(t, c)
> 
> # Resampling Time and Censoring
> cc = sample(c, replace = TRUE)
> tt = sample(t, replace = TRUE)
> xx = Surv(tt, cc)
> 
> P = predic[,1:5]
> n = 310
> ma = matrix(P, n)
> boot <- sample(seq(n), replace=TRUE)
> genes5 = ma[boot, ]
> 
> 
> for(p in 1: genes){
> i = c()
> 
> for(i in w:l) {
> z = genes5[,w: l]
> y = coxph(xx ~ z)
> 
> }
> Pval = summary(y) $ coeff[, 5]
> 
> if( any(Pval <= 0.01) ) sign <- 1 else sign <- 0
> pred[1, p] = sign[1]
> }
> 
> iter [m, 1:5] = pred[1: 5]
> 
> }

Running this code gives an error message:

Error: object 'cens' not found


And what is the purpose of t = time? time is a stats function.
> 	[[alternative HTML version deleted]]
> 

You are asked to NOT post in html.

Berend

> ______________________________________________
> 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.



More information about the R-help mailing list