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
  • 3,349
  • 17
  • 29
  • 39

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
  • 2,814
  • 2
  • 16
  • 35