R_DATACAMP6 Introduction to Data

  • 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]
)

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • rljs by sennchi Timeline of History Part One The Cognitiv...
    sennchi阅读 7,499评论 0 10
  • pyspark.sql模块 模块上下文 Spark SQL和DataFrames的重要类: pyspark.sql...
    mpro阅读 9,554评论 0 13
  • 我人生的一半是你
    果冻_deaf阅读 150评论 0 0
  • 分析客群,分理处目标顾客,针对目标顾客设定我们的服务模式,闲逛的顾客会冲淡我们目标顾客的凸出性,但不影响第一目标的...
    李媛even阅读 80评论 0 0