Re: [R] Multiplying two vectors of the same size to give a third vector of the same size

2023-06-20 Thread Philip Rhoades via R-help
Exactly except I meant: Result <- C[C > threshold] Thanks! Phil. -Original Message- From: R-help On Behalf Of Philip Rhoades via R-help Sent: Tuesday, June 20, 2023 11:38 AM To: r-help@r-project.org Subject: [R] Multiplying two vectors of the same size to give a th

Re: [R] OK, next Q - a sort of factorial on a vector

2023-06-20 Thread Philip Rhoades via R-help
I am thinking of shouldn't need any grunt that would require rewriting any functions in C or Rust or something . . P. On Tue, Jun 20, 2023 at 8:46 PM Philip Rhoades via R-help wrote: Ivan, On 2023-06-21 03:32, Ivan Krylov wrote: В Wed, 21 Jun 2023 03:13:52 +1000 Philip Rhoades

Re: [R] Multiplying two vectors of the same size to give a third vector of the same size

2023-06-20 Thread Philip Rhoades via R-help
second Q was something reasonable to ask the list? Anyway now that I need to use R again, the basics should come back to me I hope - but I will check out the tutorials again in any case . . Thanks to Uwe as well (very nice!), Phil. On Tue, Jun 20, 2023 at 8:38 AM Philip Rhoades via R-h

Re: [R] OK, next Q - a sort of factorial on a vector

2023-06-20 Thread Philip Rhoades via R-help
Ivan, On 2023-06-21 03:32, Ivan Krylov wrote: В Wed, 21 Jun 2023 03:13:52 +1000 Philip Rhoades via R-help пишет: This: !(1,2,3,4,5) would give this: (2,3,4,5, 6,8,10, 12,15, 20) Do you mean taking a product of every element of the vector with all following vector elements? A

[R] OK, next Q - a sort of factorial on a vector

2023-06-20 Thread Philip Rhoades via R-help
People, What I mean is, is there an elegant way to do this: This: !(1,2,3,4,5) would give this: (2,3,4,5, 6,8,10, 12,15, 20) and this: !(1,2,NA,4,5) would give this: (2,4,5, 8,10, 20) ? Thanks! Phil. -- Philip Rhoades PO Box 896 Cowra NSW 2794 Australia E-mail: p...@pricom.

Re: [R] Multiplying two vectors of the same size to give a third vector of the same size

2023-06-20 Thread Philip Rhoades via R-help
< threshold] Ah, I see . . And you can of course do all the above as a one-liner. Yes. Is that what you wanted? Exactly except I meant: Result <- C[C > threshold] Thanks! Phil. -Original Message- From: R-help On Behalf Of Philip Rhoades via R-help Sent: Tues

[R] Multiplying two vectors of the same size to give a third vector of the same size

2023-06-20 Thread Philip Rhoades via R-help
People, I am assuming that what I want to do is easier in R than say Ruby. I want to do what the Subject says ie multiply the cells in the same position of two vectors (A and B) to give a result in the same position in a third vector (C) BUT: - The values in the cells of A and B are floats b