开始使用免费开始使用

整洁的大表

作为将 "tidyverse" 与 "bigmemory" 套件结合使用的最后一个练习,您将再次使用 tidyrggplot2 包来绘制随时间变化的 Borrower Income 比率。

本练习是课程的一部分

R 的可扩展数据处理

查看课程

练习说明

  • 加载 tidyrggplot2 包。
  • 使用 pivot_longer() 函数按年份整理计数。
  • 创建一个折线图,x 轴为 Year,y 轴为 Count。按 BIR 着色并分组。

交互式实操练习

通过完成这段示例代码来试试这个练习。

# Load the tidyr and ggplot2 packages
library(___)
library(___)

bir_df_wide %>% 
    # Transform the wide-formatted data.frame into the long format
    ___(-BIR, names_to = "Year", values_to = "Count") %>%
    # Use ggplot to create a line plot
    ggplot(aes(x = ___, y = ___, group = BIR, color = BIR)) + 
    ___
编辑并运行代码