Skip to content
Prev 381256 / 398502 Next

Creating a before-and-after variable in R

Can we do this very simply?
My understanding is that you have a column where all the elements are
zero except for perhaps a single one.
Consider an example 0 0 1 0 0 where you want -2 -1 0 1 2.  This is 1 2
3 4 5 - 3.
[1] -2 -1  0  1  2

I may have misunderstood and you may want -2 -1 1 2 3.  If so, just
will do the trick.
On Fri, 4 Oct 2019 at 03:46, Faradj Koliev <faradj.g at gmail.com> wrote: