当前位置:网站首页>R language bug? report errors? As for the outcome of sub variables 0 and 1, the original content of the outcome variable is changed through the process of factor and numeric?
R language bug? report errors? As for the outcome of sub variables 0 and 1, the original content of the outcome variable is changed through the process of factor and numeric?
2022-06-21 18:40:00 【Illegal account 247188】
problem RT
Because I'm doing PSM Inverse probability weighted sum matching method , And chi square test when making tables , Their requirements for the type of outcome variables are different , I am in the process of transformation , Find out outcome Content 0 1 become 12 , Although they are 0=1 、1=2 Has little effect on the transformation of , But I'm extracting hierarchically outcome=0 when , Want to extract the control group , No corresponding data is found . So this bug How did it come about ?
data <- iris # Iris
data$outcome <- rep(0:1,each=75)
table(data$outcome)
str(data$outcome)
#outcome Factorization
data$outcome <- as.factor(data$outcome)
table(data$outcome) # here outcome still 0 and 1
str(data$outcome)
#outcome Continue to convert to numerical type
data$outcome <- as.numeric(data$outcome)
table(data$outcome) # At this time, I found out outcome 01 The Subvariable becomes 1 and 2
str(data$outcome)
#【 problem ,outcome Variable pass factor and numeric The process , Changed the original content ?】

边栏推荐
- URL module of node
- 基本文件操作
- Typescript的通用类型检查
- Node输出方式
- 国产API管理平台横向比较,到底哪家强?
- Day21Qt鼠标事件2021-11-01
- College Physics Chapter 9 vibration
- 2022年R1快开门式压力容器操作操作证考试题库模拟考试平台操作
- 结构建模设计——Solidworks软件之特征成型中旋转切除与圆角倒角功能实战总结(绘制一个沉头螺丝孔)
- Under the banana whose R & D accounts for only 3%, is it sunscreen black technology or IQ tax in summer?
猜你喜欢
随机推荐
9. suffix and prefix functions -suffix basename addsuffix addprefix
Start! Alibaba programming summer 2022
剑指 Offer 37. 序列化二叉树
How typescript is constructed
科普大佬说 | 如何打造自己的AI创造力?
Canvas球体粒子变幻颜色js特效
使用tidevice启动WDA
Day11QPainter2021-09-26
基于mitmproxy的录制回放接口测试工具
产品图文列表说明布局样式
Node的全局安装
力扣160. 相交链表
Typescript的构造方式
In the new season, China Super League and Guoan are moving forward amid thorns
Crawling frog SEO spider
剑指 Offer 28. 对称的二叉树
左右两侧垂直带序号的时间轴
Module import method of node
剑指Offer 57. 二叉树的下一个节点
C2—Qt实现串口调试助手2021.10.21








