I am quite new in R and now I am working on a long data set for a while and end up with a 2 Columns (Countries and Profit):
y <- data.frame(tapply(sub$Profit, sub$Country, sum))
y <- rename(y, Profit = tapply.sub.Profit..sub.Country..sum.)
y <- cbind(Country = rownames(y), y)
rownames(y) <- 1:nrow(y)
y <- y %>% arrange(+Profit)
y
0 Country Profit
1 Slovakia 56264.49
2 Luxembourg 59903.52
3 Ireland 104150.35
4 Sweden 109208.67
5 Finland 137918.93
6 Norway 159719.46
7 Portugal 199447.42
8 Netherlands 214398.10
9 Switzerland 248677.00
10 Czech Republic 286430.06
11 Denmark 305669.83
12 Belgium 316599.95
13 Poland 349640.12
14 Austria 397716.80
15 Italy 433439.35
16 Spain 520474.14
17 France 525408.81
18 United Kingdom 565622.63
19 Germany 643194.62
Now am trying to plot a barchart with it but am Strugling.
graph_country_profit <- ggplot(y, aes(x=Profit,y=Country)) + geom_col(width = 0.5, aes(fill="Profit"))
graph_country_profit
but the graph comes 1st. Pink, 2nd. With weird numbers. how can I fix it? Any explanations why is it so?? Would also be possible to order it increasing/decreasing?
Thank you for your time and help!