Advertisement
Guest User

Untitled

a guest
Jun 9th, 2011
238
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
R 3.25 KB | None | 0 0
  1. letters_freq <- structure(list(a = c(0.11602, 0.07636, 0.0651, 0.1253, 0.1463,
  2. 0.1212, 0.1174, 0.1168, 0.093, 0.08, 0.172, 0.0749), b = c(0.04702,
  3. 0.00901, 0.0189, 0.0142, 0.0104, 0.0098, 0.0092, 0.0295, 0.013,
  4. 0.013, 0, 0.0158), c = c(0.03511, 0.0326, 0.0306, 0.0468, 0.0388,
  5. 0.0078, 0.045, 0.0097, 0.013, 0.038, 0, 0.0124), d = c(0.0267,
  6. 0.03669, 0.0508, 0.0586, 0.0499, 0.0304, 0.0373, 0.0487, 0.045,
  7. 0.03, 0, 0.0593), e = c(0.02, 0.14715, 0.174, 0.1368, 0.1257,
  8. 0.0899, 0.1179, 0.0901, 0.099, 0.069, 0.074, 0.1891), f = c(0.03779,
  9. 0.01066, 0.0166, 0.0069, 0.0102, 0.0103, 0.0095, 0.0044, 0.02,
  10. 0.001, 0, 0.0081), g = c(0.0195, 0.00866, 0.0301, 0.0101, 0.013,
  11. 0.0117, 0.0164, 0.0134, 0.033, 0.01, 0, 0.034), h = c(0.07232,
  12. 0.00737, 0.0476, 0.007, 0.0128, 0.0038, 0.0154, 0.0114, 0.021,
  13. 0.01, 0, 0.0238), i = c(0.06286, 0.07529, 0.0755, 0.0625, 0.0618,
  14. 0.1001, 0.1128, 0.0827, 0.051, 0.07, 0.148, 0.065), j = c(0.00631,
  15. 0.00545, 0.0027, 0.0044, 0.004, 0.035, 0, 1e-04, 0.007, 0.019,
  16. 0.03, 0.0146), k = c(0.0069, 0.00049, 0.0121, 1e-04, 2e-04, 0.0416,
  17. 0, 0.0471, 0.032, 0.027, 0.051, 0.0225), l = c(0.02705, 0.05456,
  18. 0.0344, 0.0497, 0.0278, 0.0614, 0.0651, 0.0575, 0.052, 0.031,
  19. 0.102, 0.0357), m = c(0.04374, 0.02968, 0.0253, 0.0315, 0.0474,
  20. 0.0299, 0.0251, 0.0374, 0.035, 0.024, 0.044, 0.0221), n = c(0.02365,
  21. 0.07095, 0.0978, 0.0671, 0.0505, 0.0796, 0.0688, 0.0723, 0.088,
  22. 0.047, 0.116, 0.1003), o = c(0.06264, 0.05378, 0.0251, 0.0868,
  23. 0.1073, 0.0878, 0.0983, 0.0245, 0.041, 0.071, 0.077, 0.0606),
  24.     p = c(0.02545, 0.03021, 0.0079, 0.0251, 0.0252, 0.0274, 0.0305,
  25.     0.0079, 0.017, 0.024, 0.037, 0.0157), q = c(0.00173, 0.01362,
  26.     2e-04, 0.0088, 0.012, 0, 0.0051, 0, 7e-05, 0, 0, 9e-05),
  27.     r = c(0.01653, 0.06553, 0.07, 0.0687, 0.0653, 0.0591, 0.0637,
  28.     0.0695, 0.083, 0.035, 0, 0.0641), s = c(0.07755, 0.07948,
  29.     0.0727, 0.0798, 0.0781, 0.0609, 0.0498, 0.0295, 0.063, 0.038,
  30.     0.041, 0.0373), t = c(0.16671, 0.07244, 0.0615, 0.0463, 0.0474,
  31.     0.0527, 0.0562, 0.0309, 0.087, 0.024, 0.046, 0.0679), u = c(0.01487,
  32.     0.06311, 0.0435, 0.0393, 0.0463, 0.0318, 0.0301, 0.0343,
  33.     0.018, 0.018, 0.032, 0.0199), v = c(0.00619, 0.01628, 0.0067,
  34.     0.009, 0.0167, 0.019, 0.021, 0.0098, 0.024, 0, 0, 0.0285),
  35.     w = c(0.06661, 0.00114, 0.0189, 2e-04, 1e-04, 0, 0, 0, 3e-04,
  36.     0.036, 0.028, 0.0152), x = c(5e-05, 0.00387, 3e-04, 0.0022,
  37.     0.0021, 0, 0, 0, 0.001, 0, 0, 4e-04), y = c(0.0162, 0.00308,
  38.     4e-04, 0.009, 1e-04, 0, 0, 0.0337, 0.006, 0.032, 0, 0.00035
  39.     ), z = c(5e-04, 0.00136, 0.0113, 0.0052, 0.0047, 0.005, 0.0049,
  40.     0.015, 2e-04, 0.051, 0, 0.0139)), .Names = c("a", "b", "c",
  41. "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p",
  42. "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"), row.names = c("English",
  43. "French ", "German ", "Spanish ", "Portuguese ", "Esperanto ",
  44. "Italian ", "Turkish ", "Swedish ", "Polish ", "Toki Pona ",
  45. "Dutch"), class = "data.frame")
  46.  
  47.  
  48. cmd <- cmdscale(dist(letters_freq), eig=TRUE, k=2)
  49. x <- cmd$points[,1]
  50. y <- cmd$points[,2]
  51. nm <- row.names(letters_freq)
  52.  
  53. require(plotrix)
  54. k <- if(require(RColorBrewer)) rep(brewer.pal(8,"Dark2"), length.out=12) else "black"
  55. par(mar=c(0,0,0,0)+1)
  56. plot(x, y, col=k, pch=19)
  57. thigmophobe.labels(x, y, nm, font=2, col=k)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement