美文网首页
R_DATACAMP6 Introduction to Data

R_DATACAMP6 Introduction to Data

作者: 一条很闲的咸鱼 | 来源:发表于2018-08-10 14:00 被阅读0次
  • Language of data 数据语言

用data()导入dataset

droplevels()把没用的levels去除掉
一般可以用table()查看levels

ifelse(test, yes, no)
test为真,输出yes值,否则输出no值。

email50_fortified <- email50 %>%
mutate(number_yn = case_when(
number == "none" ~ "no",
number != "none" ~ "yes"
)
)

  • Sampling strategies and experimental design

sample_n()随机抽样

x = case_when(
[condition 1] ~ [value of x when condition 1 is true],
[condition 2] ~ [value of x when condition 2 is true],
[condition 3] ~ [value of x when condition 3 is true]
)

相关文章

网友评论

      本文标题:R_DATACAMP6 Introduction to Data

      本文链接:https://www.haomeiwen.com/subject/lsdxbftx.html