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
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
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:
>>
>>
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
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
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
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
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
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
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
>
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
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
> >>&
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
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&
À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
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
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
17 matches
Mail list logo