从下方给定的 diamonds 数据集中,只提取 price 大于 1000 且 cut 为 Ideal 的行。
From the given 'diamonds' dataset, extract only the rows where the 'price' value is greater than 1000 and the 'cut' is 'Ideal'.
题目类型: 技术面试题
这是一道技术面试题,常见于澳洲IT公司面试中。
难度: easy
分类: data-wrangling
标签: R, dplyr, filter, ggplot2, dataset
参考答案摘要
核心答案 首先加载 ggplot2 包: library(ggplot2) 然后加载 dplyr 包: library(dplyr) // It is based on the grammar of data manipulation. 提取满足条件的记录: diamonds %>% filter(price>1000 & cut==”Ideal”) -> diamonds_1000_idea
本题提供 STAR 原则详细解答和技术解析,登录匠人学院学习中心即可查看完整答案。