Re: [R] Stack dataframes into a matrix

2016-07-27 Thread David Winsemius
> On Jul 27, 2016, at 8:56 AM, Anamika Chaudhuri wrote: > > > Y<-matrix(1:40,ncol=2) > Y1<-Y/60 # estimates of p > > #print(Y1) > > sigma2<- > matrix(c(var(Y1[,1]),cov(Y1[,1],Y1[,2]),cov(Y1[,1],Y1[,2]),var(Y1[,2])),2,2) > #print(sigma2) > > rho<-sigma2[1,2]/sqrt(sigma2[1,1]*sigma2[2,2]) > #

Re: [R] Stack dataframes into a matrix

2016-07-27 Thread Anamika Chaudhuri
Hi David, Thanks for your response. rbind doesnot seem to work. Here is a reproducible example Y<-matrix(1:40,ncol=2) Y1<-Y/60 # estimates of p #print(Y1) sigma2<- matrix(c(var(Y1[,1]),cov(Y1[,1],Y1[,2]),cov(Y1[,1],Y1[,2]),var(Y1[,2])),2,2) #print(sigma2) rho<-sigma2[1,2]/sqrt(sigma2[1,1]*sigm

Re: [R] Stack dataframes into a matrix

2016-07-26 Thread David Winsemius
> On Jul 26, 2016, at 8:07 PM, Anamika Chaudhuri wrote: > > I have 100 datasets with 20 rows and 2 columns in each dataset. > I am looking for help to produce x and y below as 1000 X 20 matrix and then > repeat that across 100 datasets using R > > library(MASS) > library(car) >