View source: R/as.data.frame.nonogram.R
as.data.frame.nonogram | R Documentation |
Extracts the solution of a solved nonogram into a tidy data.frame. Used primarily for tidying the data prior to plotting.
## S3 method for class 'nonogram'
as.data.frame(nonogram, with_solution = TRUE)
nonogram |
An object of class nonogram. |
with_solution |
|
If with_solution
= FALSE
, the function will return a data.frame
with the appropriate column and row indices, but the value
column will
contain only 0s. This is only really useful when plotting a nonogram without
its solution. If with_solution
= TRUE
and the nonogram does not have a
solution, the function will throw an error.
A data.frame with 3 columns:
value
: If with_solution
= TRUE
, the solution for each position. All 0 otherwise.
column
: The column index where 1 = the leftmost column.
row
: The row index where 1 = the top row.
f <- examples[[1]] |> solve(verbose = FALSE)
as.data.frame(f)
as.data.frame(f, with_solution = FALSE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.