Re: [R] What don't I understand about sample()?

2025-03-14 Thread avi.e.gross
Kevin, I was amused by the use of the parentheses wrapping to get the REPL to show the effects of an assignment but would remove that in any final program if the output is not needed. I am not saying this is wrong, nor what I describe below, but just a discussion of how others might do it. I

Re: [R] What don't I understand about sample()?

2025-03-14 Thread Kevin Zembower via R-help
Thank you all, very much, for your kind and detailed explanations. I didn't understand, mainly, that the matrix() call only called its parameters once. I was certain that this was a bug with sample() getting seeded with a constant value, and giving the same permutation. I think I need to make my M

Re: [R] What don't I understand about sample()?

2025-03-14 Thread Jorgen Harmse via R-help
I agree with the other answers. In particular, Bert Gunter points out that each argument to a function is evaluated at most once. Default arguments can use information in the callee's frame (and order of evaluation may matter), but arguments provided by the caller are evaluated in the caller's e