[R] Use correlation matrix to get values for a new data frame

2013-10-27 Thread tobias schlager
c[9,8] <-c[8,9]; c[10,8] <-c[8,10]; c[10,9] <-c[9,10]; d <- c (c[,1], c[,2], c[,3],c[,4],c[,5],c[,6],c[,7],c[,8],c[,9],c[,10]) newdat <- expand.grid(x1c=c(1,0),x2c=c(1,0),x3c=c(1,0),x4c=c(1,0),x5c=c(1,0),x6c=c(1,0),x7c=c(1,0),x8c=c(1,0),x9c=c(1,0),x10c=c(1,0)) _

[R] Sums based on values of other matrix

2013-09-26 Thread tobias schlager
Dear all, I have a big problem: - I got two matrices, A and B - A shows identifies the value of B, however the values of B must be summed - For instance, 1 1 2 2 2 2 1 1 gives matrix a 3 4 2 1 1 1 2 2 gives matrix b Now the result for the value 1 would be 7 4 which are the rowsums o

[R] Convert chr pieces to numbers that have specific values defined by 2 vectors

2013-09-02 Thread tobias schlager
Dear all, I think this is an easy task, but I don't know how to do it. Specifically, I have 69 columns with 300.000 rows. In each cell there is a code like "2E3", "4RR", etc. I now have a list that replaces this with values, e.g., old new 2E3 5 4RR 3 etc. The lis