Re: [R] Create a variable lenght string that can be used in a dimnames statement

2023-07-04 Thread avi.e.gross
Interesting to read all the answers. Personally, I was a bit irked to see that using a combination of assignments using rownames() and colnames() did not work as one canceled what the other had done. But it turns out if we listed to what John really wanted versus what he said he wanted, then a

Re: [R] Create a variable lenght string that can be used in a dimnames statement

2023-07-04 Thread Ivan Krylov
(Sorry for the double post.) On Tue, 4 Jul 2023 10:14:43 +0300 Ivan Krylov wrote: > Try replacing the _second_ paste() in the example above with a c(). What I had forgotten to mention is that you also need to replace the initial assignment > string="" with the following: string =

Re: [R] Create a variable lenght string that can be used in a dimnames statement

2023-07-04 Thread Ivan Krylov
On Mon, 3 Jul 2023 20:08:06 + "Sorkin, John" wrote: > # create variable names xxx1 and xxx2. > string="" > for (j in 1:2){ > name <- paste("xxx",j,sep="") > string <- paste(string,name) > print(string) > } > # Creation of xxx1 and xxx2 works > string You need to distinguish between a

Re: [R] Create a variable lenght string that can be used in a dimnames statement

2023-07-03 Thread Sorkin, John
My life is complete. I have inspired a fortune! John From: Rolf Turner Sent: Monday, July 3, 2023 6:34 PM To: Bert Gunter Cc: Sorkin, John; r-help@r-project.org (r-help@r-project.org); Achim Zeileis Subject: Re: [R] Create a variable lenght string that

Re: [R] Create a variable lenght string that can be used in a dimnames statement

2023-07-03 Thread Ebert,Timothy Aaron
At least on my system string has a single value of " xxx1 xxx2" not "xxx1" and "xxx2". The variable zzz has two values: "J K xxx1" and "J K xxx2" What you want is "J", "K", "xxx1", "xxx2" If I cheat everything works. So then the goal is to rewrite the program so cheating is not needed. #

Re: [R] Create a variable lenght string that can be used in a dimnames statement

2023-07-03 Thread Rolf Turner
On Mon, 3 Jul 2023 13:40:41 -0700 Bert Gunter wrote: > I am not going to try to sort out your confusion, as others have > already tried and failed. Fortune nomination!!! cheers, Rolf Turner -- Honorary Research Fellow Department of Statistics University of Auckland Stats. Dep't.

Re: [R] Create a variable lenght string that can be used in a dimnames statement

2023-07-03 Thread Bert Gunter
I am not going to try to sort out your confusion, as others have already tried and failed. But I will point out that "string" of variables is pretty much nonsense in R. A "character vector"/"vector of strings" is probably what you mean and want to provide column names // names for the second

[R] Create a variable lenght string that can be used in a dimnames statement

2023-07-03 Thread Sorkin, John
Colleagues, I am sending this email again with a better description of my problem and the area where I need help. I need help creating a string of variables that will be accepted by the dimnames function. The string needs to start with the dimnames j and k followed by a series of dimnames