cssearcy / AYS-R-Coding-SPR-2020

Coding in R for Policy Analytics
https://cssearcy.github.io/AYS-R-Coding-SPR-2020/
3 stars 3 forks source link

Lab 06 - Step 1 Error with #23

Open Ilenia22 opened 3 years ago

Ilenia22 commented 3 years ago

Hello everyone,

I am having a problem with step one. Please, see my code and the error message I get below.

My code:

total.sal <- Salaries %>%
  group_by( teamID, yearID ) %>%
  summarize(player = n(),
            total.cost = sum( salary.adj, na.rm = TRUE) )

Error message:
`summarise()` regrouping output by 'teamID' (override with `.groups` argument)
jamisoncrawford commented 3 years ago

Hi @Ilenia22, did you write Error message: in there manually? That's not actually an error, it's just telling you something R is doing so you understand what's happening under the hood!

Ilenia22 commented 3 years ago

Yes, I did write Error message it just says the below.

jamisoncrawford commented 3 years ago

@Ilenia22 very good! So this is a good distinction between an "error" and a "message". In this example, we can see that R is telling us a little more information about the variable, teamID, on which summarize() is regrouping.

It's atypical since, normally, "messages" appear in blue while "errors" appear in black (depending on your RStudio theme and preferences). Glad you raised this issue here since many others had the same concern!