0

What's wrong with this code? trying to get grouped means by Parameter name which is the names of the chemicals, there are multiple arithmetic means for each chemical in the column and they are numeric and the names are characters.

Q2<-daily_SPEC %>%
             group_by('Parameter Name', add=FALSE)%>%
             summarize(Mean_by_chemical=mean(daily_SPEC$"Arithmetic Mean", 
na.rm=TRUE))
Q2
  Mean_by_chemical
1          105.401
  • 6
    It's difficult to say without seeing at least a sample of the data `daily_SPEC`. But you should not use `$` to specify column names, just use mean('Arithmetic Mean'), but put it in backticks, not quotes (hard to format correctly in a comment). – neilfws May 10 '18 at 01:43
  • `group_by` doesn't take string input – Tung May 10 '18 at 02:16
  • 3
    Let's see if we can escape backticks in comments :) `summarize(Mean_by_chemical = mean(\`Arithmetic Mean\`, na.rm = TRUE))` – neilfws May 10 '18 at 03:33

0 Answers0