[R] replacing characters in matrix. substitute, delayedAssign, huh?

2012-01-30 Thread Paul Johnson
A user question today has me stumped. Can you advise me, please? User wants a matrix that has some numbers, some variables, possibly even some function names. So that has to be a character matrix. Consider: BM - matrix(0.1, 5, 5) Use data.entry(BM) or similar to set some to more abstract

Re: [R] replacing characters in matrix. substitute, delayedAssign, huh?

2012-01-30 Thread Richard M. Heiberger
Are you sure this isn't a dataframe? Some minor rethinking of the structure might get it there. Rich On Mon, Jan 30, 2012 at 1:26 PM, Paul Johnson pauljoh...@gmail.com wrote: A user question today has me stumped. Can you advise me, please? User wants a matrix that has some numbers, some

Re: [R] replacing characters in matrix. substitute, delayedAssign, huh?

2012-01-30 Thread Henrik Bengtsson
The quick solution: parseAndEval - function(x, ...) eval(parse(text=x)) apply(BM, MARGIN=c(1,2), FUN=parseAndEval) My $.02 /Henrik On Mon, Jan 30, 2012 at 10:26 AM, Paul Johnson pauljoh...@gmail.com wrote: A user question today has me stumped.  Can you advise me, please? User wants a matrix

Re: [R] replacing characters in matrix. substitute, delayedAssign, huh?

2012-01-30 Thread Gabor Grothendieck
On Mon, Jan 30, 2012 at 1:26 PM, Paul Johnson pauljoh...@gmail.com wrote: A user question today has me stumped.  Can you advise me, please? User wants a matrix that has some numbers, some variables, possibly even some function names.  So that has to be a character matrix. Consider: BM -

Re: [R] replacing characters in matrix. substitute, delayedAssign, huh?

2012-01-30 Thread Duncan Murdoch
On 30/01/2012 1:26 PM, Paul Johnson wrote: A user question today has me stumped. Can you advise me, please? User wants a matrix that has some numbers, some variables, possibly even some function names. So that has to be a character matrix. It might make more sense for it to be a list-mode

Re: [R] replacing characters in matrix. substitute, delayedAssign, huh?

2012-01-30 Thread Paul Johnson
Henrik's proposal works well, so far. Thanks very much. I could not have figured that out (without much more suffering). Here's the working example in case future googlers find their way to this thread. ## Paul Johnson paulj...@ku.edu ## 2012-01-30 ## Special thanks to r-help email list