[R] Looking for a function or a set of steps
paul zachos
@nth@n@@|o@ @end|ng |rom me@com
Sun May 18 19:40:31 CEST 2025
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?
Thank you,
paz
More information about the R-help
mailing list