![]() ![]() Require(ff) require(ffbase) f <- system.file( "extdata", "Carlsen.gz", package = "bigchess") con <- gzfile(f, "rbt", encoding = "latin1") # options("fftempdir"="/path/".) # if necessarily fdf <- (con, stat.moves = FALSE) delete(fdf) # Works with all types of connections (also gz or zip files). In case of big files use () or () instead of # Example downloaded from and gzipped: f <- system.file( "extdata", "Carlsen.gz", package = "bigchess") con <- gzfile(f, encoding = "latin1") df <- read.pgn(con, quiet = TRUE) # Fastest mode: con <- gzfile(f, encoding = "latin1") df <- read.pgn(con, quiet = TRUE, n.moves = FALSE, extract.moves = FALSE, stat.moves = FALSE, = FALSE) # Parse additional tags and extract all moves: con <- gzfile(f, encoding = "latin1") df <- read.pgn(con, add.tags = c( "WhiteElo", "BlackElo", "ECO"), extract.moves = - 1) # Example of direct downloading data from using API: df <- read.pgn( "") # Warning of incomplete line could appear # Example of scraping all of games given user: user <- "fabianocaruana" library( "rjson") json_file <- paste0( "",user, "/games/archives") json_data <- fromJSON( paste( readLines(json_file), collapse= "")) result <- ame() for(i in json_data $archives) result <- rbind(result, read.pgn( paste0(i, "/pgn"))) ![]() ![]() F <- system.file( "extdata", "2016_Candidates.pgn", package = "bigchess") df <- read.pgn(f) #. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
December 2022
Categories |