Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- library(dplyr)
- library(ggplot2)
- library(scales)
- library(reshape2)
- library(tibble)
- Prepare data
- file="C:...../Desktop/pa.csv"
- df <- read.csv(file, header=TRUE, sep=",") %>%
- rownames_to_column( var = "country" ) %>% # tibble
- head(country)
- mutate_each(funs(rescale), -country) %>% # scales
- melt(id.vars=c('country'), measure.vars=colnames(file)) %>%
- arrange(country)
- Facet by variable
- df %>%
- ggplot(aes(x=country, y=value, group=variable, color=variable)) +
- geom_polygon(fill=NA) +
- coord_polar() + theme_bw() + facet_wrap(~ variable) +
- #scale_x_discrete(labels = abbreviate) + # Can increase the text size and uncomment
- theme(axis.text.x = element_text(size = 3))
- var1, var2, var3, var4, var5, var6
- c1,1,3,3,3,2
- c2,2,4,3,4,4
- c3,5,5,3,3,5
- c4,4,4,2,3,3
- c5,4,4,3,4,5
- c6,5,5,3,2,5
- c7,5,5,4,5,5
- c8,5,5,4,4,5
- c9,4,4,2,3,3
- c10,4,3,2,2,2
- c11,5,4,3,5,5
- c12,4,4,3,3,3
- c13,3,2,3,3,1
- c14,3,2,2,3,4
Add Comment
Please, Sign In to add comment