一幅图告诉你,为什么要学R?

😄😄感觉这个标题好“标题党”😄😄

Business Science最近写了一篇博客,SIX REASONS TO LEARN R FOR BUSINESS,告诉了我们学习R语言的6大理由。其中作者用ggplot2绘制的散点图正是我们应该学习R语言的最好证明!😄

下面是原作者给的代码:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
library(ggplot2)
library(ggrepel)
library(viridis)
#> Loading required package: viridisLite
library(tibble)
library(magrittr)
data_apps <- tribble(
~application, ~business_capability, ~ease_of_learning, ~trend, ~cost,
"R", 10, 4, 10, "Free",
"Python", 7, 4, 10, "Free",
"Excel", 4, 10, 7, "Low",
"Tableau", 6, 7, 6, "Low",
"PowerBI", 5, 8, 6, "Low",
"Matlab", 6, 2, 1, "High",
"SAS", 8, 4, 3, "High"
)
data_apps
#> # A tibble: 7 x 5
#> application business_capability ease_of_learning trend cost
#> <chr> <dbl> <dbl> <dbl> <chr>
#> 1 R 10.0 4.00 10.0 Free
#> 2 Python 7.00 4.00 10.0 Free
#> 3 Excel 4.00 10.0 7.00 Low
#> 4 Tableau 6.00 7.00 6.00 Low
#> 5 PowerBI 5.00 8.00 6.00 Low
#> 6 Matlab 6.00 2.00 1.00 High
#> 7 SAS 8.00 4.00 3.00 High
cap <- paste0(
"Why R? Tools like Excel, Tableau, PowerBI are easier to learn, but have lower ",
"Business Capability. Tools like Python, SAS, and Matlab have high ",
"Data Science Capability, but lack the visualization and interactive ",
"application tools needed for business. R has the best data science, visualization, ",
" and interactive tools plus it's free!"
)
data_apps %>%
ggplot(aes(x = business_capability, y = ease_of_learning,
color = cost, size = trend)) +
geom_point() +
geom_label_repel(aes(label = application, fill = application),
size = 3.5,
fontface = 'bold', color = 'white',
box.padding = 0.1, point.padding = 0.5,
segment.color = 'grey50', segment.size = 1) +
geom_smooth(color = "black", method = "lm", se = FALSE, show.legend = F) +
expand_limits(x = c(4, 10), y = c(0, 10)) +
theme(legend.direction = "vertical") +
theme_minimal() +
scale_fill_viridis(discrete = TRUE) +
scale_color_viridis(discrete = TRUE) +
scale_y_continuous(breaks = seq(0, 10, 2)) +
scale_x_continuous(breaks = 0:10) +
scale_size_continuous(range = c(2, 14)) +
labs(title = "DS4B Tools: Capability Vs Learning Curve",
subtitle = "R has a longer learning curve but has a massive business capability rating",
caption = label_wrap_gen(115)(cap),
x = "Data Science For Business Capability Rating",
y = "Learning Curve Rating",
color = "Cost",
size = "Trend",
fill = "Tool")

参考