0

I want to group the tidyr dataset relig_income by religion, show the mean of the believers by N_People and order them DESC through the mean. I tried the first code but according to my online-course, the correct answer appears to be the second. What does the dot, in the function of arrange, means?

I am getting two different results.

  1. My Code:

    tidy_df %>% group_by(religion) %>% summarise(mean_believers = mean(N_People)) %>% arrange(mean_believers, desc(mean_believers))

  2. Correct Answer:

    tidy_df %>% group_by(religion) %>% summarise(mean_believers = mean(N_People)) %>% arrange(., desc(mean_believers))

JMP
  • 4,417
  • 17
  • 30
  • 41

1 Answers1

0

The . is the notation for the data passed through %>%. For example, you can reference specific columns of the data with .$your_column

Take a look at the documentation for pipe

mhovd
  • 3,724
  • 2
  • 21
  • 47