Hello, I have two data. x<-c(1, 2, 1, 3, 2) y<-c(3, 1, 2, 3, 5) 1. How do i create matrix from this two. what i want is this x y 1 1 3 2 2 1 3 1 2 4 3 3 5 2 5 2. what is the best way to use chisq.test to get the p.value thanks Claire -- View this message in context: http://www.nabble.com/Creating-Matrix-tp17168173p17168173.html Sent from the R help mailing list archive at Nabble.com.
See ?cbind and ?matrix. Gabor On Sat, May 10, 2008 at 03:21:26PM -0700, Claire_6700 wrote:> > Hello, > > I have two data. > > x<-c(1, 2, 1, 3, 2) > y<-c(3, 1, 2, 3, 5) > > How do i create matrix from this two. > > what i want is this > > x y > 1 1 3 > 2 2 1 > 3 1 2 > 4 3 3 > 5 2 5 > > thanks > Claire > -- > View this message in context: http://www.nabble.com/Creating-Matrix-tp17168173p17168173.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > 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.-- Csardi Gabor <csardi at rmki.kfki.hu> UNIL DGM
how do i calculate the p-value of trend test <power oquote author="Claire_6700"> Hello, I have two data. x<-c(1, 2, 1, 3, 2) y<-c(3, 1, 2, 3, 5) 1. How do i create matrix from this two. what i want is this x y 1 1 3 2 2 1 3 1 2 4 3 3 5 2 5 2. what is the best way to use chisq.test to get the p.value thanks Claire -- View this message in context: http://www.nabble.com/Creating-Matrix-tp17168173p17170180.html Sent from the R help mailing list archive at Nabble.com.
Here is how you can apply the mat function mentioned by Cassardi, x<-c(1, 2, 1, 3, 2) y<-c(3, 1, 2, 3, 5) mat<-matrix(c(x,y),5,2) ##the first parameter gives the data vector wich is filled columnwise in the matrix, then comes the row and column dimensions) colnames(mat)<-c("x","y") you can also use the dimnames() function and give a list of two vectors for the rownames and colnames; Best Claire_6700 <chriseverclear at hotmail.com> a ?crit :> > Hello, > > I have two data. > > x<-c(1, 2, 1, 3, 2) > y<-c(3, 1, 2, 3, 5) > > How do i create matrix from this two. > > what i want is this > > x y > 1 1 3 > 2 2 1 > 3 1 2 > 4 3 3 > 5 2 5 > > thanks > Claire > -- > View this message in context: > http://www.nabble.com/Creating-Matrix-tp17168173p17168173.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > 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. >