search for: indx2

Displaying 8 results from an estimated 8 matches for "indx2".

Did you mean: indx
2017 Oct 12
4
comparing two strings from data
...79931 CTS2017000072015 In a loop, when I use the following code to get those indices, data_2 = read.csv("excel_data.csv") column_1 = data_2$data1 column_2 = data_2$data2 match_list <- array(0,dim=c(310,1)); # 310 is the length of the first column for (indx in 1: 310){ for(indx2 in 1:713){ # 713 is the length of the second column if(column_1[indx] == column_2[indx2] ){ match_list[indx,1] = indx2; break; } } } R provides the following error: Error in Ops.factor(column_1[indx], column_2[indx2]) : level sets of factors are diff...
2013 Feb 12
0
error message from predict.coxph
...pc2 <- mypc$objs[[1]] #debug(mypc2) #mypc2(mod2, newdata=ndf, type="expected", se.fit=TRUE) # The error appears to be an incorrect subscripting of xbar (and xbar2) in defining dt (and dt2) in one part of predict.coxph: # #if (ncol(y) == 2) { # if (se.fit) { # dt <- (chaz * newx[indx2, ]) - xbar[indx2, ] # *** SHOULD BE JUST xbar # se[indx2] <- sqrt(varh + rowSums((dt %*% object$var) * dt)) * newrisk[indx2] # } #} #else { # j2 <- approx(afit$time, 1:afit.n, newy[indx2, 2], method = "constant", f = 0, yleft = 0, yright = afit.n)$y # chaz2 <- approx(-afit...
2017 Oct 12
0
comparing two strings from data
...following code to get those indices, > > > data_2 = read.csv("excel_data.csv") > column_1 = data_2$data1 > column_2 = data_2$data2 > > match_list <- array(0,dim=c(310,1)); # 310 is the length of the first > column > > for (indx in 1: 310){ > for(indx2 in 1:713){ # 713 is the length of the second column > if(column_1[indx] == column_2[indx2] ){ > match_list[indx,1] = indx2; > break; > } > } > } > > > R provides the following error: > > Error in Ops.factor(column_1[indx], c...
2017 Oct 13
1
comparing two strings from data
...> > > data_2 = read.csv("excel_data.csv") > > column_1 = data_2$data1 > > column_2 = data_2$data2 > > > > match_list <- array(0,dim=c(310,1)); # 310 is the length of the first > > column > > > > for (indx in 1: 310){ > > for(indx2 in 1:713){ # 713 is the length of the second column > > if(column_1[indx] == column_2[indx2] ){ > > match_list[indx,1] = indx2; > > break; > > } > > } > > } > > > > > > R provides the following error: >...
2013 Sep 10
0
Looping an lapply linear regression function
Hi, Try: dat2<- read.csv("BOlValues.csv",header=TRUE,sep="\t",row.names=1) dim(dat2) #[1] 20 28 indx2<-expand.grid(names(dat2),names(dat2),stringsAsFactors=FALSE) nrow(indx2) #[1] 784 indx2New<- indx2[indx2[,1]!=indx2[,2],] nrow(indx2New) #[1] 756 res2<-sapply(seq_len(nrow(indx2New)),function(i) {x1<- indx2New[i,]; x2<-cbind(dat2[x1[,1]],dat2[x1[,2]]);summary(lm(x2[,1]~x2[,2]))$coe...
2013 Sep 27
0
Best and Worst values
...ng is not that important here.? You can just ?melt() or ?reshape() from wide to long format and when you try ddply(), it will automatically arrange the data #accordingly. indx<-cbind(rep(seq_len(nrow(resFinal)),2),rep(c(5,3),each=250))? ## 5,3 represents the column numbers Predict in resFinal indx2<-c(rep(seq(1,100,by=2),each=5),rep(seq(2,100,by=2),each=5)) indx3<- indx[order(indx2),] resNew[,2]<-as.numeric(resFinal[indx3]) indx1<-cbind(rep(seq_len(nrow(resFinal)),2),rep(c(6,4),each=250)) #6,4 represent the columns Actual in resFinal indx4<- indx1[order(indx2),] resNew[,3]<...
2009 Apr 21
4
My surprising experience in trying out REvolution's R
...b, D.u, x, z); #this is the sampling stage obj1 <- mle(b, D.u, x, yy, z, F, F, n.iter=50); obj2 <- mle(b, D.u, x, yy, z, T, F, n.iter=50); obj1$uu - obj2$uu } ################################################## mle <- function(b, D.u, x, y, z, indx1, indx2, n.iter) { u.mean.initial <- array( 0, c(n.random, m) ); for(i in 1:n.iter) { obj <- sample.u(b, D.u, x, y, z, u.mean.initial); if(indx1) b <- b - solve(obj$Hessian, obj$score); if(indx2) D.u <- obj$uu; u.mean.initial <...
2013 Apr 11
2
Read the data from a text file and reshape the data
I have a data set for different time intervals. The data has three comment lines before data for each time interval. For each time interval there are 500 data points. I want to change the dataset such that I have the following format: t1 t2 t3 ................ 0.00208 0.00417 0.00625 ................. a1 a2 a3 ...................