Find and list the ten country codes that appear most frequently in the top decile for real GDPpc (rgdppc). Find and list the ten country codes that appear most frequently in the bottom decile for real GDPpc (rgdppc).
I am trying this but nothing seems to be working. I'm trying to figure out if I'm in the right direction... I can't find a code that will list the first 10 that come up in the 10% and 90% deciles for 2 variables.
gdp<-PS3$rgdppc %>%. # my object for GDPpc
select(PS3$ccode, gdp) %>% # trying to tell R to select country code + GDPpc
quantile(PS3$ccode, probs = seq(.1, .9, by = .1)) # getting the quantiles
You can wrap your code in backticks (```) to format it better.
gdp<-PS3$rgdppc %>%. # my object for GDPpc
select(PS3$ccode, gdp) %>% # trying to tell R to select country code + GDPpc
quantile(PS3$ccode, probs = seq(.1, .9, by = .1)) # getting the quantiles
Your pipeline does not use correct syntax, however. You are piping a vector (first line) into a function that wants a dataframe (second line) and then into another function that needs a vector (third line).
To take a complete guess, I might do something like this: