【发布时间】:2021-11-05 07:02:02
【问题描述】:
我的一个朋友正在使用 r 语言并问我她做错了什么,我似乎找不到问题所在。有人知道是什么吗?
她发给我的代码:
# 10*. Pipe that to a ggplot command and create a histogram with 4 bins.
# Hint: you will NOT write ggplot(df, aes(...)) because the df is already piped in.
# Instead, just write: ggplot(aes(...)) etc.
# Title the histogram, "Distribution of Sunday tips for bills over $20"
# Feel free to style the plot (not required; this would be a typical exploratory
# analysis where only you will see it, so it doesn't have to be perfect).
df %>%
filter(total_bill > 20 & day == "Sun") %>%
ggplot(aes(x=total_bill, fill=size)) +
geom_histogram(bins=4) +
ggtitle("Distribution of Sunday tips for bills over $20")
错误:
Error in df(.) : argument "df1" is missing, with no default
【问题讨论】:
-
您好,您能否提供一个最小的数据样本,以便我们执行代码?然后更容易提供帮助。另外,您是否在此代码 sn-p 之前加载了 ggplot2 和 dplyr?
标签: r