Re: [R] Create matrix with column names wiht the same prefix xxxx and that end in 1, 2

2023-07-03 Thread Rui Barradas
rom: Jeff Newmiller Sent: Monday, July 3, 2023 2:45 PM To: Sorkin, John Cc: r-help@r-project.org Subject: Re: [R]  Create matrix with column names wiht the same prefix and that end in 1, 2 I really think you should read that help page.  colnames() accesses the second element of dimnames() di

Re: [R] Create matrix with column names wiht the same prefix xxxx and that end in 1, 2

2023-07-03 Thread Rui Barradas
aste("j","k",string) zzz # assign column names, j, k, xxx1, xxx2 to the matrix # create column names, j, k, xxx1, xxx2. dimnames(myvalues)<-list(NULL,c(zzz)) colnames(myvalues)<-zzz From: Jeff Newmiller Sent: Monday, July 3, 2023

Re: [R] Create matrix with column names wiht the same prefix xxxx and that end in 1, 2

2023-07-03 Thread Sorkin, John
umn names, j, k, xxx1, xxx2 to the matrix # create column names, j, k, xxx1, xxx2. dimnames(myvalues)<-list(NULL,c(zzz)) colnames(myvalues)<-zzz From: Jeff Newmiller Sent: Monday, July 3, 2023 2:45 PM To: Sorkin, John Cc: r-help@r-project.org Subj

Re: [R] Create matrix with column names wiht the same prefix xxxx and that end in 1, 2

2023-07-03 Thread Jeff Newmiller
I really think you should read that help page. colnames() accesses the second element of dimnames() directly. On July 3, 2023 11:39:37 AM PDT, "Sorkin, John" wrote: >Jeff, >Thank you for your reply. >I should have said with dim names not column names. I want the Mateix to have >dim names, no

Re: [R] Create matrix with column names wiht the same prefix xxxx and that end in 1, 2

2023-07-03 Thread Sorkin, John
Jeff, Thank you for your reply. I should have said with dim names not column names. I want the Mateix to have dim names, no row names, dim names j, k, xxx1, xxx2. John John David Sorkin M.D., Ph.D. Professor of Medicine Chief, Biostatistics and Informatics University of Maryland School of Medici

Re: [R] Create matrix with column names wiht the same prefix xxxx and that end in 1, 2

2023-07-03 Thread Rui Barradas
Às 19:00 de 03/07/2023, Sorkin, John escreveu: I am trying to create an array, myvalues, having 2 rows and 4 columns, where the column names are j,k,xxx1,xxx2. The code below fails, with the following error, "Error in dimnames(myvalues) <- list(NULL, zzz) : length of 'dimnames' [2] not equal

Re: [R] Create matrix with column names wiht the same prefix xxxx and that end in 1, 2

2023-07-03 Thread Jeff Newmiller
?colnames On July 3, 2023 11:00:32 AM PDT, "Sorkin, John" wrote: >I am trying to create an array, myvalues, having 2 rows and 4 columns, where >the column names are j,k,xxx1,xxx2. The code below fails, with the following >error, "Error in dimnames(myvalues) <- list(NULL, zzz) : > length of '

[R] Create matrix with column names wiht the same prefix xxxx and that end in 1, 2

2023-07-03 Thread Sorkin, John
I am trying to create an array, myvalues, having 2 rows and 4 columns, where the column names are j,k,xxx1,xxx2. The code below fails, with the following error, "Error in dimnames(myvalues) <- list(NULL, zzz) : length of 'dimnames' [2] not equal to array extent" Please help me get the code t