R_for_Data_Science_Introduction&

2020-03-25  本文已影响0人  城管大队哈队长

最近参加了刘博发起的《R for data Science》的读书会活动,差不多是每周读一个章节。我决定写一些看这本书过程中的“胡思乱想”来作为我的备忘录。

这是英文版的第1,2,3章的内容

我个人还是推荐看英文版,虽然我第一遍是看的中文版。一来英文版更新,二来英文版看多了你会熟悉Tidyverse系列的语法,这样你在日常过程中有不懂的地方,方便你去google搜索。

1.1 What you will learn


1.2 How this book is organised


1.3 What you won’t learn


1.4 Prerequisites


1.6 Getting help and learning more


3.1 Introduction


3.2 First steps

image

3.3 Aesthetic mappings



3.5 Facets



3.6 Geometric objects



3.7 Statistical transformations


img

With the fill aesthetic, the heights of the bars need to be normalized.

# 此图甚好
# 等于展现了2层结果,第一层是百分比,第二层是百分比里面的color分布
ggplot(data = diamonds) +
  geom_bar(aes(x = cut, y = ..count.. / sum(..count..), fill = color))

img

3.8 Position adjustments

ggplot(data = diamonds, mapping = aes(x = cut, fill = clarity)) + 
geom_bar(alpha = 1/5, position = "identity")
  
ggplot(data = diamonds, mapping = aes(x = cut, colour = clarity)) + 
geom_bar(fill = NA, position = "identity")
img img

identity选项对于2D图像更合适,比如说散点图



3.9 Coordinate systems



3.10 The layered grammar of graphics

上一篇 下一篇

猜你喜欢

热点阅读