【发布时间】:2021-08-26 12:37:33
【问题描述】:
我有一个这样的数据集,但要大得多:
ds2
Event act me
<fct> <dbl> <dbl>
1 Labour Costs YoY 2.33 0.0264
2 Unemployment Change (000's) -5.17 -0.449
3 Unemployment Rate 8.86 0.0900
4 Jobseekers Net Change 11.3 9.57
问题是第一个me 变量应该是2.64(所以乘以100),而第二个需要乘以10,第三个乘以100,第四个需要保持不变。这样act 和me 变量的十进制相同。
有没有办法让 R 自动识别并纠正这个问题?提前致谢。
复制数据集:
ds2 <- structure(list(Event = structure(2:5, .Label = c("Event", "Labour Costs YoY",
"Unemployment Change (000's)", "Unemployment Rate", "Jobseekers Net Change"),
.Names = c("", "", "", ""), class = "factor"), act = c(2.33230769230769, -5.17018867924528,
8.86180371352785, 11.3192307692308), me = c(0.0263725490196078,
-0.449056603773585, 0.0899796195652174, 9.56704545454545)), row.names = c(NA,
-4L), class = c("tbl_df", "tbl", "data.frame"))
【问题讨论】: