I came across this issue while writing some examples for TidierPlots. It may be that I'm just doing something wrong, but this code:
df_h = @chain penguins begin
@group_by(species)
@summarize(
mean_bill = mean(bill_length_mm),
se_bill = std(bill_length_mm) / sqrt(n())
)
@mutate(
lower = mean_bill - 1.96 * se_bill,
upper = mean_bill + 1.96 * se_bill
)
end
Fails with error "No method matching nrow()". You can get this to run by separating the steps, like so:
df_h = @chain penguins begin
@group_by(species)
@summarize(
mean_bill = mean(bill_length_mm),
sd_bill = std(bill_length_mm),
n = n()
)
@mutate(
se_bill = sd_bill / sqrt(n)
)
@mutate(
lower = mean_bill - 1.96 * se_bill,
upper = mean_bill + 1.96 * se_bill
)
end
But I don't think you would need to separate it out like this in dplyr
I came across this issue while writing some examples for TidierPlots. It may be that I'm just doing something wrong, but this code:
Fails with error "No method matching nrow()". You can get this to run by separating the steps, like so:
But I don't think you would need to separate it out like this in
dplyr