Skip to content

Instantly share code, notes, and snippets.

@josefslerka
Created December 12, 2012 13:05
Show Gist options
  • Save josefslerka/4267584 to your computer and use it in GitHub Desktop.
Save josefslerka/4267584 to your computer and use it in GitHub Desktop.
tbl <- read.csv("kv.csv", header=TRUE)
tbl <- subset(tbl, select = -X )
d <- dist(tbl)
fit <- cmdscale(d,eig=TRUE, k=2)
nazev <- c("Fischer", "Sobotka", "Franz", "Roithová", "Fischerová", "Dientsbier", "Schwarzenberg","Zeman")
x <- fit$points[,1]*(-1)
y <- fit$points[,2]
plot(x, y, xlab="levice - pravice", ylab="konzervativni - liberalni",
main="Podobnost kandidátů podle postojů", type="n", ylim=c(-6,6), xlim=c(-6,6))
text(x, y, labels = nazev)
abline(h=0, v=0, col = "gray60")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment