Skip to content

Commit

Permalink
allow skills to be missing from winning symbols df
Browse files Browse the repository at this point in the history
  • Loading branch information
raymondben committed Apr 25, 2024
1 parent 8269992 commit 2b1cc98
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion R/meta.R
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ winning_symbols_df <- function(txt) {
}

winning_symbols_df2txt <- function(x) {
if (!is.data.frame(x) || !setequal(names(x), c("skill", "win_lose", "code")) || !all(c("S", "R", "A", "B", "D", "E", "F") %in% x$skill)) stop("input in unexpected format")
if (!is.data.frame(x) || !setequal(names(x), c("skill", "win_lose", "code"))) stop("input in unexpected format")
tildepad <- function(z) paste0(paste0(z, collapse = ""), paste0(rep("~", 4 - length(z)), collapse = ""))
out <- vapply(c("S", "R", "A", "B", "D", "E", "F"), function(z) {
paste0(tildepad(x$code[x$skill == z & x$win_lose == "L"]), tildepad(x$code[x$skill == z & x$win_lose == "W"]))
Expand Down

0 comments on commit 2b1cc98

Please sign in to comment.