stencila/rasta

fix(decode): only produce an image object for each unique plot

nokome opened this issue ยท 1 comments

The evaluate function (from the R package evaluate) produces an output for each statement e.g.

lapply(evaluate('plot(1); abline(0,1)'), class)
[[1]]
[1] "source"

[[2]]
[1] "recordedplot"

[[3]]
[1] "recordedplot"

The rasta::decode function converts each output into a document node - in the above example, it will produce two ImageObjects, one for each recordedplot in the list. This is not desirable. Instead, we need a way to only generate one image output for each actual plot.

A temporary workaround is to wrap as a block e.g.

> lapply(evaluate('{plot(1); abline(0,1)}'), class)
[[1]]
[1] "source"

[[2]]
[1] "recordedplot"

๐ŸŽ‰ This issue has been resolved in version 0.8.1 ๐ŸŽ‰

The release is available on GitHub release

Your semantic-release bot ๐Ÿ“ฆ๐Ÿš€