镜向量有两个不同的值
对于回归,在一个数据集中“翻转”了一些二分法变量,并希望将它们带回另一个数据集中,类似的数据集,该数据集匹配了Rownames上。 到目前为止,运行良好,但是通过与原始变量匹配,我自然会撤消以前做过的翻转。
我的问题基本上是:如果我有一个二分法向量,是否有一些简短的方法可以简短地制作一个镜像对象,例如:(
vector.1 <- c(1,1,1,2,2,1,2)
vector.2 <- c(2,2,2,1,1,2,1)
例如:(例如mirrir_vector(vector.1)
),
如我所知,代码> Rev()将订单从前到结尾更改。
for a regression a "flipped" some dichotomous variables in one data set and want to bring them back into another, similar dataset, matched on the rownames.
So far that is working great, but by matching on the original variables I naturally undo the flipping I did before.
My question basically is: If I have a dichotomous vector, is there a short way to just make a mirrored object of it, like:
vector.1 <- c(1,1,1,2,2,1,2)
vector.2 <- c(2,2,2,1,1,2,1)
(e.g. mirror_vector(vector.1)
)
As I understood it, rev()
changes the order from front to end.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论