数据集内容
在本练习中,您将学习如何查看 abalone 数据集的信息和子集。您将使用 head() 和 tail() 查看数据集的前 3 行和后 3 行。您还将根据环数对鲍鱼进行排序。
已为您加载 abalone 数据集和 dplyr 包。
本练习是课程的一部分
面向 SAS 用户的 R
练习说明
- 查看 abalone 数据集的前 3 行和后 3 行。
- 使用
dplyr包中的arrange()函数,按环数对鲍鱼进行排序。 - 使用
dplyr的管道运算符%>%改写上面的 arrange 代码行。
交互式实操练习
通过完成这段示例代码来试试这个练习。
# View top 3 rows of abalone dataset using head()
head(___, ___)
# View bottom 3 rows of abalone dataset using tail()
tail(___, ___)
# Run arrange function from dplyr to sort the data by rings
arrange(___, ___)
# Rewrite the line of code above using the %>% notation
___ %>%
___