write.pgn: Write PGN data.frames into file

Description Usage Arguments Examples

View source: R/write.pgn.R

Description

Write PGN data.frames into file

Usage

1
write.pgn(df, file, add.tags = NULL, append = FALSE)

Arguments

df

data.frame from read.pgn()

file

string path to destination file

add.tags

string vector containing additional tags to be parsed. According to Seven Tag Roster rule: http://www.saremba.de/chessgml/standards/pgn/pgn-complete.htm#c8.1.1 The STR tag pairs appear before any other tag pairs: "Event", "Site", "Date", "Round", "White", "Black" and "Result". Using this argument you can specify supplemental tag names, such as: Player related information, Event related information, Opening information (locale specific), Opening information (third party vendors), Time and date related information, Time control, Alternative starting positions, Game conclusion and Miscellaneous. Most popular: "WhiteElo", "BlackElo","ECO","SetUp" or "FEN". Case sensitive.

append

boolean (default FALSE), should games be appended to current file?

Examples

1
2
3
4
5
6
f <- system.file("extdata", "2016_Candidates.pgn", package = "bigchess")
df <- read.pgn(f)
write.pgn(df, file = "my_file.pgn")
df2 <- read.pgn("my_file.pgn")
all.equal(df,df2) # TRUE
unlink("my_file.pgn") # clean up

Example output

Warning message:
In file(con, "r") : cannot open file '/proc/stat': Permission denied
2021-04-13 16:55:43, successfully imported 56 games
2021-04-13 16:55:43, N moves computed
2021-04-13 16:55:43, extract moves done
2021-04-13 16:55:43, stat moves computed
2021-04-13 16:55:43, successfully imported 56 games
2021-04-13 16:55:43, N moves computed
2021-04-13 16:55:43, extract moves done
2021-04-13 16:55:43, stat moves computed
[1] TRUE

bigchess documentation built on Aug. 5, 2020, 5:09 p.m.