search for: matrix2

Displaying 20 results from an estimated 44 matches for "matrix2".

Did you mean: matrix
2007 Nov 19
6
Reg : using two different matrix : how to do t.test
I have two matrix with same dimensions. I want to do t.test using each column from 2 different matrix. Row n Column names in both matrix are same. e.g. Matrix1 id VC1 VC2 VC3 R 1 2 3 R1 4 5 6 R3 7 8 9 Matrix2 id VC1 VC2 VC3 R 10 11 12 R1 13 14 15 R3 16 17 18 want to do t.test using each column (with same name ) using Matrix1 and Matrix2 for eg t.test(Matrix1$VC1, Matrix2$VC1)$p.value What is the best way to do it. I have dataset with 4000 columns for each matrix with same row and column n...
2008 Dec 12
3
The end of Matlab
Greetings! I come to R by way of Matlab. One feature in Matlab I miss is its "end" keyword. When you put "end" inside an indexing expression, it is interpreted as the length of the variable along the dimension being indexed. For example, if the same feature were implemented in R: my.vector[5:end] would be equivalent to: my.vector[5:length(my.vector)] or:
2012 Sep 04
2
Read data from .csv file as a matrix and compare the different between two matrix
...x table and should be write in . csv file. Result of the differences: A B C A 0 1 0 B 0 0 0 C 0 0 0 At the mean time, I'm able to load the .csv file and convert it to matrix matrix1 <-read.table("matrix1.csv", header=T, sep=",") matrix1 <- as.matrix(matrix1) matrix2 <- read.table("matrix2.csv", header=T, sep=",") matrix2 <- as.matrix(matrix2) But, I can't find a suitable script to compare the differences between the matrix and write it to file. Appreciate any help from the expert [[alternative HTML version deleted]]
2012 Aug 02
1
Filter a matrix with a matrix HELP!
Hi, just during these vacation days, I'm trying to approach with multicore package and I have some troubles with foreach. What I'm trying to do is to extract a data in coordinate (ii,jj) from a matrix2, only if the data in the same coordinate in matrix1 is ==1. Make this with a nested "for" take a lot of time because I have thousand of values. ex. Binary_hex = NULL foreach(ii=1:nrow(matrix2)) %:% foreach(jj=1:ncol(matrix2)) %dopar% {when(matrix2[ii,jj] == 1) %:% {Binary_hex <- c(Bin...
2007 Aug 18
2
Problem with lsa package (data.frame) on Windows XP
...RUE, language="spanish", minWordLength=2, minDocFreq=1, stopwords=NULL, vocabulary=NULL) print(matrix1,bag_lines = 3, bag_cols = 3) matrix1 = lw_bintf(matrix1) * gw_idf(matrix1) space = lsa(matrix1, dims = dimcalc_share()) as.textmatrix(space) ### the following line fails on windows XP matrix2 = textmatrix("C:\\Documents and Settings\\tine stalmans.TINE. 000\\LSA\\respuestas\\", stemming=TRUE, language="spanish", minWordLength=2, minDocFreq=1, stopwords=NULL,vocabulary=rownames (matrix1)) matrix2 = lw_bintf(matrix2) matrix2fld = fold_in(matrix2, space) r <- cor...
2013 Mar 01
2
issue creating a subset
...e condition. So: ORIGINAL matrix<-cbind(item1, item2, item3, item4) IF I PERFORM A head(matrix) item1 item2 item3 item4 3 2 3 1 3 1 2 4 THEN I CREATE THE LOGIC CONDITION z<-thing==T THEN I TRY TO CREATE THE NEW MATRIX BUT WITH THE CONDITION matrix2<-cbind(item1[z==T], item2[z==T], item3[z==T], item4[z==T]) THE ISSUE IS THAT IF I PERFORM A head(matrix2) I1 I2 I3 I4 3 2 3 1 3 1 2 4 The names of the columns change at all. CAN ANYONE HELP ME TO KEEP THE SAME NAMES? [[alternat...
2004 Feb 24
2
matrix() Help
...ormal numbers into a 3 by 8 matrix. y in this case would be 3, 1, and 4; so the resulting matrix should be such that the first row has three different Normal numbers; the second row has 1 Normal number; and the third row has four different Normal numbers. I have the following code to do that: > matrix2 <- matrix(rnorm(poisNums),nrow=3,ncol=8) To my surprise, matrix2 does not look anything like what I had intended. Instead, it repeats the values in the first column (of the matrix2) eight times. What part of the code do I need to fix? [[alternative HTML version deleted]]
2009 Feb 26
0
How do I retrieve column and row names after comparing two matrices?
...... name2 2,0 1,2 1,2 ... name3 0,2 1,0 2,0 ... name4 2,0 0,2 0,2 ... Comparison of both matrices reports a unique difference based on the following code: informative<-which(matrix1!=matrix2) transitions<-napaste(matrix1,matrix2)[informative] unique_transitions<-unique(transitions) lfreq<-list(State_transitions=unique_transitions) lf<-as.data.frame(lfreq) plot(lf) write.tab...
2010 Feb 26
2
dramatic speed difference in lapply
...sum(data[cdata,"A"], na.rm=T), sum(data[cdata,"A"], na.rm=T)))) } else { return(lapply(split(cdata,data[cdata,pivotColumns[level]], drop=T), function(x) lapplyFunctionRecurse(x, level+1, ...))) } } result = lapplyFunctionRecurse(data, ...) matrix2 <- do.call('rbind', lapply(result, function(x) do.call('rbind',x))) return(matrix2) } dat <- data.frame(D=sample(32000:33000, 666000, T),Fid=sample(1:10,666000,T), A=sample(1:5,666000,T)) > temp = proc.time(); ret = fedb.ddplyWrapper2(dat, c("D", "Fid&q...
2007 Dec 14
1
Result depends on previous result; easy with a loop; but without a loop?
Dear all, I am pretty sure that this has been discussed before. Unfortunately, I can not find anything in the archives -- probably because I am "RSiteSearching" for the wrong terms. If I remember correctly, I think I even asked this question a few years ago. But I cannot even find this. The basic problem is that a result depends on a previous result. This is easy with a loop--but
2010 Feb 22
1
rownames cannot allocate vector of size
Hi, On R 2.10.1 for Windows, when I do the following to duplicate the structure of a large numeric matrix called matrix1: matrix2 <- matrix(0,nrow=nrow(matrix1),ncol=ncol(matrix1)) and then rownames(matrix2) <- rownames(matrix1) I get a "cannot allocate vector of size xxMb" error but if I instead do: rnames <- list() rnames <- rownames(matrix1) matrix2 <- matrix(0,nrow=nrow(matrix1),ncol=ncol(mat...
2011 Feb 02
2
subset in a BIG matrix
I have a matrix with a lot of values inside.. when I execute the folowing command matrix2=subset(martix, condition.....) it works... but after the previous command I execute another "subset" matrix3=subset(martix2, condition2.....) and appears the following error: (subscript) logical subscript too long How can I solve this??? I think the probles is the size of the matrix...
2010 Feb 10
2
system.time provides inaccurate sys.child (PR#14210)
...WORK_create_matrix(int) WORK_create_matrix(double) #undef WORK_create_matrix #define create_double_matrix(dim1,dim2)\ m_create_double_matrix(dim1,dim2,__LINE__,__FILE__) int main(int argc, char *argv[]) { double **matrix1 = create_double_matrix(size, size); double **matrix2 = create_double_matrix(size, size); int iterations = 0; int i,j; double iter_limit = 100; alpha = rand(); beta = rand(); while (iterations < iter_limit) { for (i = 0; i < size; i++) { for (j = 0; j < size; j++) { if (i == j) cont...
2012 Sep 19
4
correlating matrices
Hi, thank you for taking the time and reading my question. My question is twofold: 1. I have several matrices with variables and one matrix with water levels. I want to predict the water level with the data in the other matrices. Basically, * mod<-lm(matrix1 ~ matrix2+matrix3)* ( What looks like a minus is meant to be the wiggly minus.) Of course I could dissemble the matrices and paste their columns into one long, long vector. But the method above gives reasonable results. Are there any methodological objections against doing this? 2. After having done the reg...
2007 May 04
2
Get the difference between two matrices with different length
Hello, I have got two matrices with different length. The matrices have 3 columuns. The first two are coordinates. The third is a measurement. Now I want to get a subtraction between every single value of the third column (between matrix1 and matrix2), but only if the two first coordinates in matrix1 and matrix2 are the same. I tried "FUN=?" in aggregate and ave, but I don't know the command for such a subtraction? Thank's a lot. Felix --------------- The matrixes (examlple): 1 0.1 0.0042 1 0.2 0.00423 1 0.4 0.00467 1...
2008 May 06
1
Significance analysis of Microarrays (SAM)
Dear list, I am trying to perform a significance analysis of a microarray experiment with survival data using the {samr} package. I have a matrix containing my data which has 17816 rows corresponding to genes, and 286 columns corresponding to samples. The name of this matrix is data.matrix2. Some of the first values of this matrix are: data.matrix2[1:3,1:5] GSM36777 GSM36778 GSM36779 GSM36780 GSM36781 [1,] 1.009274 1.0740659 1.048540 1.015946 1.022650 [2,] 1.007992 0.8768410 0.962442 1.111742 1.121150 [3,] 0.981853 0.9606492 1.024987 1.053302 1.063408 I also have the time in w...
2009 Aug 18
2
Embedding lists in matrices and matrices in lists
...database[x,y] consists of a list of matrices that all have the dimensions ncol(matrix1)=x and nrow(matrix1)=y. So those matrices have to be embedded into lists and the lists have to be embedded in the big database matrix. If I simply try database=matrix(0,10,10) database[4,4]=c(matrix1,matrix2) I get Error in database[4, 4] = c(matrix1, matrix2) : number of items to replace is not a multiple of replacement length Execution halted which makes sense of course... Is there any possibility to make this work? Or maybe there is a better way to organize those matrices? Regards...
2009 Mar 26
1
Extreme AIC in glm(), perfect separation, svm() tuning
...0 on 55 degrees of freedom Penalized deviance: 261.7148 AIC: 120.6 2) Classifiers with perfect separation with a too small AIC(around 50), co-efficients does Not converge. The prediction error of itself by glm() is 0! brglm() is no better than glm() in this case. Code and output of glm(): matrix2 <- read.table("http://ihome.ust.hk/~haitian/sample2.txt") names(matrix2)<- c("g0","g28","g1334","g1871","g3639","g4295") library(MASS) fo2 <- as.formula(g0 ~ g28 * g1334 * g1871 * g3639 * g4295) lr2 <- glm(fo2, family...
2010 Jan 08
2
How to Merge based on Rows
...s, my actual data tables are far too enormous): Matrix1 Apples Oranges Pears A 5 6 7 B 5 3 4 C 8 9 10 D 11 13 14 E 15 3 8 F 1 4 5 Matrix2 Apples Oranges Pears A 5 3 9 B 3 2 1 C 3 4 5 E 8 1 4 G 3 2 1 I cannot use cbind or rbind, because I have different rows in each matrix (e.g....
2006 May 16
0
reordering materix presentation in heatmap.2 in the 'gplots' library
...min(Matrix1),max(Matrix1),len=20), col=rich.colors(19), na.rm=T) z$Rowv, z$Colv are now dendrograms of the rows and the columns repectively (this couldn't be done with heatmap.2 since it doesn't return the dendrogram objects). and I've tried to create the wanted image using: heatmap.2(Matrix2, symm=T, breaks=20, col=rich.colors(19), main="Matrix2", density.info="histogram", denscol="black", Colv=z$Colv, Rowv=z$Rowv, trace="none", na.rm=T, keysize=1.5, dendrogram="none") The problem is that I get the column and row lables in the wanted o...