2
library(dplyr)
data <- data_frame(ended= c("14/11/2016 13:37", "14/11/2016 13:37",
"14/11/2016 13:47", "14/11/2016 13:51", "14/11/2016 13:51"),
satisfactionLevel = c("Very dissatisfied", "Very satisfied",
"Satisfied", "Neither satisfied nor dissatisfied",
"Very satisfied"))
私は、次の値既存の列の文字列
- 0が割り当てられている
weightScores <- data_frame(weight = c(0, 0.5, 0.75, 1))
をとる列
weight
を追加するに基づいて列を追加するときsatisfactionLevel =「非常に不満」 、 - 1 satisfactionLevel = "非常に満足"の場合、
- 0.75 w鶏満足度レベル= "満足"、
- "どちらも満足でも不満でもない"場合0.5。 (
case_when
付き)
エレガントなソリューションを使用することができるはずです、まさに私は望んでいた。 +1私から – Greconomist
@Greconomist助けて幸せ:-) – PoGibas