[R] Loading Chess Data

Robert Baer rbaer at atsu.edu
Tue Sep 11 16:43:20 CEST 2012


On 9/2/2012 11:41 AM, David Arnold wrote:
> All,
>
> What would be the most efficient way to load the data at the following
> address into a dataframe?
>
> http://ratings.fide.com/top.phtml?list=men
It depends.  The most efficient for me was to highlight it, copy it to 
the windows clipboard and execute the following R command.
chess <- read.table(file='clipboard', header = TRUE, sep = '\t')

If you want you can then set it to use in an R post or a script:
chess2 <- dput(chess)
chess2
# You would include similar to the following in your script or email:
chess3 <-
structure(list(Rank = 1:101, Name = structure(c(17L, 8L, 48L,
77L, 66L, 5L, 45L, 18L, 40L, 61L, 35L, 91L, 88L, 44L, 97L, 30L,
29L, 53L, 42L, 33L, 90L, 75L, 56L, 21L, 41L, 1L, 96L, 6L, 26L,
83L, 15L, 99L, 4L, 58L, 14L, 64L, 79L, 82L, 9L, 47L, 63L, 69L,
7L, 55L, 60L, 86L, 95L, 74L, 84L, 92L, 93L, 20L, 52L, 80L, 81L,
98L, 67L, 94L, 38L, 24L, 19L, 31L, 2L, 87L, 49L, 13L, 25L, 46L,
16L, 39L, 3L, 23L, 22L, 78L, 12L, 51L, 37L, 89L, 34L, 72L, 70L,
101L, 10L, 85L, 100L, 54L, 65L, 28L, 76L, 32L, 57L, 71L, 50L,
43L, 68L, 62L, 27L, 73L, 59L, 36L, 11L), .Label = c(" Adams, Michael",
" Akopian, Vladimir", " Alekseev, Evgeny", " Almasi, Zoltan",
" Anand, Viswanathan", " Andreikin, Dmitry", " Areshchenko, Alexander",
" Aronian, Levon", " Bacrot, Etienne", " Balogh, Csaba", " Bartel, 
Mateusz",
" Bauer, Christian", " Berkes, Ferenc", " Bologan, Viktor", " Bruzon 
Batista, Lazaro",
" Bu, Xiangzhi", " Carlsen, Magnus", " Caruana, Fabiano", " Cheparinov, 
Ivan",
" Ding, Liren", " Dominguez Perez, Leinier", " Dreev, Aleksey",
" Edouard, Romain", " Efimenko, Zahar", " Eljanov, Pavel", " Fressinet, 
Laurent",
" Fridman, Daniel", " Gareev, Timur", " Gashimov, Vugar", " Gelfand, 
Boris",
" Georgiev, Kiril", " Gharamian, Tigran", " Giri, Anish", " Grachev, 
Boris",
" Grischuk, Alexander", " Gupta, Abhijeet", " Gyimesi, Zoltan",
" Harikrishna, P.", " Inarkiev, Ernesto", " Ivanchuk, Vassily",
" Jakovenko, Dmitry", " Jobava, Baadur", " Jones, Gawain C B",
" Kamsky, Gata", " Karjakin, Sergey", " Kasimdzhanov, Rustam",
" Korobov, Anton", " Kramnik, Vladimir", " Kryvoruchko, Yuriy",
" Kurnosov, Igor", " Laznicka, Viktor", " Le, Quang Liem", " Leko, Peter",
" Li, Chao b", " Malakhov, Vladimir", " Mamedyarov, Shakhriyar",
" Matlakov, Maxim", " McShane, Luke J", " Meier, Georg", " Moiseenko, 
Alexander",
" Morozevich, Alexander", " Motylev, Alexander", " Movsesian, Sergei",
" Naiditsch, Arkadij", " Najer, Evgeniy", " Nakamura, Hikaru",
" Navara, David", " Negi, Parimarjan", " Nepomniachtchi, Ian",
" Ni, Hua", " Nielsen, Peter Heine", " Onischuk, Alexander",
" Petrosian, Tigran L.", " Polgar, Judit", " Ponomariov, Ruslan",
" Potkin, Vladimir", " Radjabov, Teimour", " Ragger, Markus",
" Riazantsev, Alexander", " Rublevsky, Sergei", " Sargissian, Gabriel",
" Sasikiran, Krishnan", " Shirov, Alexei", " Short, Nigel D",
" So, Wesley", " Sokolov, Ivan", " Sutovsky, Emil", " Svidler, Peter",
" Tiviakov, Sergei", " Tomashevsky, Evgeny", " Topalov, Veselin",
" Vachier-Lagrave, Maxime", " Vallejo Pons, Francisco", " Van Wely, Loek",
" Vitiugov, Nikita", " Volokitin, Andrei", " Wang, Hao", " Wang, Yue",
" Wojtaszek, Radoslaw", " Zhigalko, Sergei", " Zvjaginsev, Vadim"
), class = "factor"), Title = structure(c(1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L
), .Label = " g", class = "factor"), Country = structure(c(22L,
1L, 25L, 3L, 27L, 16L, 25L, 18L, 26L, 25L, 25L, 5L, 25L, 27L,
6L, 17L, 3L, 15L, 13L, 21L, 25L, 26L, 3L, 7L, 25L, 10L, 26L,
25L, 12L, 19L, 7L, 24L, 15L, 10L, 20L, 14L, 25L, 16L, 12L, 26L,
1L, 25L, 26L, 25L, 26L, 21L, 25L, 15L, 10L, 12L, 11L, 6L, 29L,
25L, 1L, 6L, 8L, 21L, 16L, 26L, 5L, 5L, 1L, 17L, 26L, 15L, 26L,
28L, 6L, 25L, 25L, 12L, 25L, 2L, 12L, 8L, 15L, 21L, 25L, 27L,
6L, 25L, 15L, 23L, 4L, 6L, 25L, 27L, 25L, 12L, 25L, 9L, 25L,
10L, 16L, 25L, 14L, 1L, 14L, 16L, 24L), .Label = c(" ARM", " AUT",
" AZE", " BLR", " BUL", " CHN", " CUB", " CZE", " DEN", " ENG",
" ESP", " FRA", " GEO", " GER", " HUN", " IND", " ISR", " ITA",
" LAT", " MDA", " NED", " NOR", " PHI", " POL", " RUS", " UKR",
" USA", " UZB", " VIE"), class = "factor"), Rating = c(2843L,
2816L, 2797L, 2788L, 2783L, 2780L, 2778L, 2773L, 2769L, 2758L,
2754L, 2752L, 2747L, 2746L, 2742L, 2738L, 2737L, 2737L, 2734L,
2730L, 2730L, 2729L, 2729L, 2725L, 2724L, 2722L, 2718L, 2718L,
2714L, 2714L, 2713L, 2713L, 2713L, 2713L, 2712L, 2712L, 2712L,
2707L, 2705L, 2705L, 2705L, 2704L, 2702L, 2700L, 2699L, 2699L,
2699L, 2698L, 2698L, 2697L, 2697L, 2694L, 2693L, 2693L, 2693L,
2691L, 2691L, 2691L, 2690L, 2689L, 2689L, 2687L, 2687L, 2687L,
2686L, 2685L, 2684L, 2684L, 2683L, 2683L, 2682L, 2678L, 2677L,
2677L, 2676L, 2675L, 2674L, 2674L, 2672L, 2672L, 2671L, 2671L,
2668L, 2667L, 2667L, 2665L, 2664L, 2663L, 2663L, 2663L, 2663L,
2662L, 2660L, 2658L, 2658L, 2658L, 2657L, 2657L, 2656L, 2654L,
2654L), Games = c(10L, 0L, 0L, 0L, 10L, 0L, 9L, 0L, 0L, 2L, 9L,
0L, 9L, 9L, 10L, 0L, 0L, 0L, 4L, 10L, 0L, 11L, 0L, 0L, 9L, 0L,
11L, 9L, 10L, 6L, 9L, 4L, 0L, 0L, 8L, 0L, 0L, 0L, 20L, 11L, 11L,
0L, 11L, 10L, 11L, 10L, 9L, 0L, 0L, 21L, 14L, 13L, 0L, 0L, 0L,
10L, 0L, 0L, 11L, 11L, 10L, 25L, 0L, 0L, 0L, 0L, 11L, 0L, 9L,
0L, 9L, 21L, 10L, 7L, 21L, 6L, 0L, 0L, 11L, 8L, 0L, 0L, 0L, 9L,
0L, 0L, 0L, 18L, 9L, 0L, 0L, 0L, 11L, 11L, 9L, 0L, 9L, 9L, 20L,
9L, 0L), B.Year = c(1990L, 1982L, 1975L, 1987L, 1987L, 1969L,
1990L, 1992L, 1969L, 1977L, 1983L, 1975L, 1976L, 1974L, 1989L,
1968L, 1986L, 1979L, 1983L, 1994L, 1987L, 1983L, 1985L, 1983L,
1983L, 1971L, 1986L, 1990L, 1981L, 1972L, 1982L, 1987L, 1976L,
1984L, 1971L, 1985L, 1985L, 1981L, 1983L, 1985L, 1978L, 1990L,
1986L, 1980L, 1980L, 1968L, 1987L, 1976L, 1965L, 1990L, 1982L,
1992L, 1991L, 1974L, 1983L, 1987L, 1985L, 1972L, 1986L, 1985L,
1986L, 1965L, 1971L, 1977L, 1986L, 1985L, 1983L, 1979L, 1985L,
1985L, 1985L, 1990L, 1969L, 1988L, 1977L, 1988L, 1977L, 1973L,
1986L, 1975L, 1983L, 1976L, 1987L, 1993L, 1989L, 1989L, 1977L,
1988L, 1982L, 1984L, 1991L, 1973L, 1985L, 1987L, 1993L, 1979L,
1976L, 1984L, 1987L, 1989L, 1985L)), .Names = c("Rank", "Name",
"Title", "Country", "Rating", "Games", "B.Year"), class = "data.frame", 
row.names = c(NA,
-101L))





This should get you started.

Rob

> Thanks,
>
> David
>
>
>
> --
> View this message in context: http://r.789695.n4.nabble.com/Loading-Chess-Data-tp4642006.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.




More information about the R-help mailing list