Re: [R] Create matrix with variable number of columns AND CREATE NAMES FOR THE COLUMNS

2024-07-01 Thread Heinz Tuechler via R-help
Sorkin, John wrote/hat geschrieben on/am 01.07.2024 17:54: #I am trying to write code that will create a matrix with a variable number of columns where the #number of columns is 1+Grps #I can do this: NSims <- 4 Grps <- 5 DiffMeans <- matrix(nrow=NSims,ncol=1+Grps) DiffMeans #I have a problem

Re: [R] Create matrix with variable number of columns AND CREATE NAMES FOR THE COLUMNS

2024-07-01 Thread Jeff Newmiller via R-help
I think you should reconsider your goal. Matrices must have all elements of the same type, and in this case you seem to be trying to mix a number of something (integer) with mean values (double). This would normally be stored together in a data frame or separately in a vector for counts and a

Re: [R] Create matrix with variable number of columns AND CREATE NAMES FOR THE COLUMNS

2024-07-01 Thread Rui Barradas
Às 16:54 de 01/07/2024, Sorkin, John escreveu: #I am trying to write code that will create a matrix with a variable number of columns where the #number of columns is 1+Grps #I can do this: NSims <- 4 Grps <- 5 DiffMeans <- matrix(nrow=NSims,ncol=1+Grps) DiffMeans #I have a problem when I try

Re: [R] Create matrix with variable number of columns AND CREATE NAMES FOR THE COLUMNS

2024-07-01 Thread Rui Barradas
Às 16:54 de 01/07/2024, Sorkin, John escreveu: #I am trying to write code that will create a matrix with a variable number of columns where the #number of columns is 1+Grps #I can do this: NSims <- 4 Grps <- 5 DiffMeans <- matrix(nrow=NSims,ncol=1+Grps) DiffMeans #I have a problem when I try

Re: [R] Create matrix with variable number of columns AND CREATE NAMES FOR THE COLUMNS

2024-07-01 Thread Ebert,Timothy Aaron
onday, July 1, 2024 11:54 AM To: r-help@r-project.org (r-help@r-project.org) Subject: [R] Create matrix with variable number of columns AND CREATE NAMES FOR THE COLUMNS [External Email] #I am trying to write code that will create a matrix with a variable number of columns where the #number of col

[R] Create matrix with variable number of columns AND CREATE NAMES FOR THE COLUMNS

2024-07-01 Thread Sorkin, John
#I am trying to write code that will create a matrix with a variable number of columns where the #number of columns is 1+Grps #I can do this: NSims <- 4 Grps <- 5 DiffMeans <- matrix(nrow=NSims,ncol=1+Grps) DiffMeans #I have a problem when I try to name the columns of the matrix. I want the