write.pgn: Write PGN data.frames into file

Description Usage Arguments Examples

Description

Write PGN data.frames into file

Usage

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

Arguments

df

data.frame from read.pgn()

file

string path to destination file

add.tags

string vector containing additional tags to be parsed.

append

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

source.movetext

boolean (default TRUE), if set and SourceMovetext appears in df then write SourceMovetext as Movetext; else use parsed Movetext 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.

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

rosawojciech/bigchess documentation built on Jan. 19, 2021, 5:54 a.m.