[R] Looking for a function or a set of steps
@vi@e@gross m@iii@g oii gm@ii@com
@vi@e@gross m@iii@g oii gm@ii@com
Tue May 20 01:00:58 CEST 2025
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 to perhaps using a manual loop with indices and ...
I will say that these days, I see too many assignments handed in by novices, such as 12-year-old kids that strike me as clearly done with help even beyond what a parent might have used in days gone by. I have done keyword searches and found copying whole paragraphs and graphs and images from sources like Wiki, propaganda included, and, of course, in programming courses, code. Sometimes it is even simpler and assembled by an "AI" which implicitly did the equivalent of a guided internet search.
-----Original Message-----
From: R-help <r-help-bounces using r-project.org> On Behalf Of Rolf Turner
Sent: Monday, May 19, 2025 6:26 PM
To: r-help using r-project.org
Cc: paul zachos <anthanasios using me.com>
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 <r-help using r-project.org> 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 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 like to generate a new vector in which the ‘1’s in x become
> ‘0’s and the ‘0’s in x become ‘1’s.
>
> How should I go about this?
Looks suspiciously like a homework question to me.
cheers,
Rolf Turner
--
Honorary Research Fellow
Department of Statistics
University of Auckland
Stats. Dep't. (secretaries) phone:
+64-9-373-7599 ext. 89622
Home phone: +64-9-480-4619
______________________________________________
R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide https://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
More information about the R-help
mailing list