Re: [R] Looking for a function or a set of steps

2025-06-02 Thread Richard O'Keefe
nges it to another TRUE value like 4. When there is no reason not > to, using a Boolean data type is often best for some uses. > > > -Original Message- > From: R-help On Behalf Of Mike Day via > R-help > Sent: Thursday, May 29, 2025 3:45 AM > To: R help Mailing

Re: [R] Looking for a function or a set of steps

2025-05-29 Thread avi.e.gross
n data type is often best for some uses. -Original Message- From: R-help On Behalf Of Mike Day via R-help Sent: Thursday, May 29, 2025 3:45 AM To: R help Mailing list Subject: Re: [R] Looking for a function or a set of steps What's wrong with 1-x ? Sent from my iPad > On 2

Re: [R] Looking for a function or a set of steps

2025-05-29 Thread Mike Day via R-help
What's wrong with 1-x ? Sent from my iPad > On 28 May 2025, at 21:41, Avi Gross wrote: > > Paul, > > Perhaps slightly better and more concise is > > y <- -x + 1 > > Why multiply? Of course it may be optimized in some cases. > >> On Tue, May 27, 2025, 3:36 AM Paul Zachos wrote: >> >>

Re: [R] Looking for a function or a set of steps

2025-05-28 Thread Avi Gross
Paul, Perhaps slightly better and more concise is y <- -x + 1 Why multiply? Of course it may be optimized in some cases. On Tue, May 27, 2025, 3:36 AM Paul Zachos wrote: > Wow! Amazing stuff. > It will take me a while to digest all that you have offered here. > > I came up with a simple solut

Re: [R] Looking for a function or a set of steps

2025-05-27 Thread Paul Zachos
Wow! Amazing stuff. It will take me a while to digest all that you have offered here. I came up with a simple solution myself: y<- (-1*x)+1 Thank you _ Paul Zachos, PhD Director, Research and Evaluation Association for the Cooperative Advancement of Science and Education (ACASE) 1

Re: [R] Looking for a function or a set of steps

2025-05-26 Thread paul zachos via R-help
Thank you. I came up with a slightly more complicated solution than yours myself: y<- (-1*x) +1 I did not realize that adding a scalar to a vector would add that scalar to each element of the vector. Nice! > On May 19, 2025, at 4:18 AM, Erich Subscriptions > wrote: > > 1-x > >> On 18.05.20

Re: [R] Looking for a function or a set of steps

2025-05-20 Thread Richard O'Keefe
The obvious answer is 1-x. Another answer, which is good for converting any 0..n elements to any others, is c(1,0)[x+1]. But the most important questions are - where did x come from? - what does it mean? - why do you want to do this? - what do you already know about R? Do you understand vector

Re: [R] Looking for a function or a set of steps

2025-05-19 Thread Goodale, Tom via R-help
Surely doing y <- 1 - x would be the simplest way? Best, Tom > -Original Message- > From: R-help On Behalf Of Rui Barradas > Sent: 19 May 2025 08:08 > To: paul zachos ; r-help@r-project.org > Subject: Re: [R] Looking for a function or a set of steps > > Às 1

Re: [R] Looking for a function or a set of steps

2025-05-19 Thread Rolf Turner
On Mon, 19 May 2025 19:00:58 -0400 wrote: > Rolf, > > If it is homework, I have to wonder at what level the class is before > any of the proposed answers would be considered acceptable by the > instructor. For a true beginner who has not even learned that much of > R is vectorized, we are back

Re: [R] Looking for a function or a set of steps

2025-05-19 Thread avi.e.gross
19, 2025 6:26 PM To: r-help@r-project.org Cc: paul zachos Subject: Re: [R] Looking for a function or a set of steps On Sun, 18 May 2025 13:40:31 -0400 paul zachos via R-help wrote: > Dear R Community > > I am an R beginner > > I have a vector of ‘1’s and ‘0’s > > x >

Re: [R] Looking for a function or a set of steps

2025-05-19 Thread Rolf Turner
On Sun, 18 May 2025 13:40:31 -0400 paul zachos via R-help wrote: > Dear R Community > > I am an R beginner > > I have a vector of ‘1’s and ‘0’s > > x > [1] 0 0 1 0 0 1 1 0 1 0 1 1 1 0 1 1 0 0 1 0 1 0 1 0 0 0 0 > [28] 0 1 1 0 1 0 1 1 0 0 0 0 1 0 1 1 0 0 1 0 0 1 0 0 0 1 1 > [55] 0 0 1 0 1 0 0

Re: [R] Looking for a function or a set of steps

2025-05-19 Thread Sergei Ko
d be the simplest way? > >> > >> Best, > >> Tom > >> > >>> -Original Message- > >>> From: R-help On Behalf Of Rui Barradas > >>> Sent: 19 May 2025 08:08 > >>> To: paul zachos ; r-help@r-project.org > >>&

Re: [R] Looking for a function or a set of steps

2025-05-19 Thread Rui Barradas
half Of Rui Barradas Sent: 19 May 2025 08:08 To: paul zachos ; r-help@r-project.org Subject: Re: [R] Looking for a function or a set of steps Às 18:40 de 18/05/2025, paul zachos via R-help escreveu: Dear R Community I am an R beginner I have a vector of '1's and '0's x    [1] 0 0

Re: [R] Looking for a function or a set of steps

2025-05-19 Thread Rui Barradas
Original Message- From: R-help On Behalf Of Rui Barradas Sent: 19 May 2025 08:08 To: paul zachos ; r-help@r-project.org Subject: Re: [R] Looking for a function or a set of steps Às 18:40 de 18/05/2025, paul zachos via R-help escreveu: Dear R Community I am an R beginner I have a vector of '1&

Re: [R] Looking for a function or a set of steps

2025-05-19 Thread Rui Barradas
Às 18:40 de 18/05/2025, paul zachos via R-help escreveu: Dear R Community I am an R beginner I have a vector of ‘1’s and ‘0’s x [1] 0 0 1 0 0 1 1 0 1 0 1 1 1 0 1 1 0 0 1 0 1 0 1 0 0 0 0 [28] 0 1 1 0 1 0 1 1 0 0 0 0 1 0 1 1 0 0 1 0 0 1 0 0 0 1 1 [55] 0 0 1 0 1 0 0 0 1 1 1 1 0 1 0 0 0 1 0 0 1

Re: [R] Looking for a function or a set of steps

2025-05-19 Thread Erich Subscriptions
1-x > On 18.05.2025, at 19:40, paul zachos via R-help wrote: > > Dear R Community > > I am an R beginner > > I have a vector of ‘1’s and ‘0’s > > x > [1] 0 0 1 0 0 1 1 0 1 0 1 1 1 0 1 1 0 0 1 0 1 0 1 0 0 0 0 > [28] 0 1 1 0 1 0 1 1 0 0 0 0 1 0 1 1 0 0 1 0 0 1 0 0 0 1 1 > [55] 0 0 1 0 1 0 0 0

[R] Looking for a function or a set of steps

2025-05-18 Thread paul zachos via R-help
Dear R Community I am an R beginner I have a vector of ‘1’s and ‘0’s x [1] 0 0 1 0 0 1 1 0 1 0 1 1 1 0 1 1 0 0 1 0 1 0 1 0 0 0 0 [28] 0 1 1 0 1 0 1 1 0 0 0 0 1 0 1 1 0 0 1 0 0 1 0 0 0 1 1 [55] 0 0 1 0 1 0 0 0 1 1 1 1 0 1 0 0 0 1 0 0 1 1 0 0 0 0 0 [82] 1 1 1 0 1 0 0 1 0 0 1 1 1 1 1 I would lik