title: Working with factors: put two function into dplyr
body: <p>I was just looking for a tidier way to get the output of the following data:</p>
  
  <pre><code>library(dplyr)
  librray(gapminder)
  
  gapminder$continent %&gt;% class() 
  gapminder$continent %&gt;% nlevels()
  gapminder$continent %&gt;% levels()
  gapminder$continent %&gt;% str()
  </code></pre>
  
  <p>It looks a bhit repetitive, so I want to merge it into one line using dplyr, so I tried the following: </p>
  
  <pre><code>gapminder$continent %&gt;% class() %&gt;% nlevels() %&gt;% levels() %&gt;% str()
  #AND
  gapminder %&gt;% summarise_at(vars(continent), list(class = class, nlevels = nlevels,levels= levels))
  </code></pre>
  
  <p>but of course, those does not work. I am not sure how can I get the output.
  the similar issue arises when I want to plot changing factors:</p>
  
  <pre><code>gapminder$continent = gapminder$continent %&gt;%
    fct_relevel( "Oceania", "Europe")
  
  gapminder %&gt;%
    ggplot() +
    geom_bar(aes(fct_relevel( continent,"Africa", "Oceania"))) +
    coord_flip()+
    theme_bw() +
    labs(color = "country") 
  </code></pre>
  
  <p>Can I combine them together?</p>