diff --git a/DESCRIPTION b/DESCRIPTION index 769b202..5acb496 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,9 +1,12 @@ Package: marshal -Version: 0.0.1-9003 +Version: 0.0.1-9004 Title: Framework to Marshal Objects to be Used in Another R Process Depends: R (>= 3.2.0) Suggests: + knitr, + DT, + jsonlite, bundle, caret, data.table, @@ -32,6 +35,8 @@ Suggests: xgboost, XML, xml2 +VignetteBuilder: + knitr Authors@R: person(given = "Henrik", family = "Bengtsson", role = c("aut", "cre", "cph"), @@ -44,4 +49,4 @@ ByteCompile: TRUE URL: https://marshal.futureverse.org, https://github.com/HenrikBengtsson/marshal BugReports: https://github.com/HenrikBengtsson/marshal/issues Roxygen: list(markdown = TRUE) -RoxygenNote: 7.2.3 +RoxygenNote: 7.3.1 diff --git a/inst/known_cases.json b/inst/known_cases.json new file mode 100644 index 0000000..efa5292 --- /dev/null +++ b/inst/known_cases.json @@ -0,0 +1,175 @@ +[ + { + "package": "base", + "type": "connection", + "if_not_marshalled": "error, incorrect result, file corruption", + "can_be_marshalled": false, + "must_be_marshalled": true + }, + { + "package": "parallel", + "type": "SOCKnode, SOCK0node", + "if_not_marshalled": "error", + "can_be_marshalled": false, + "must_be_marshalled": true + }, + { + "package": "arrow", + "type": "Array, Table", + "if_not_marshalled": "error", + "can_be_marshalled": true, + "must_be_marshalled": true + }, + { + "package": "caret", + "type": "train", + "if_not_marshalled": "", + "can_be_marshalled": true, + "must_be_marshalled": true + }, + { + "package": "cpp11", + "type": "function", + "if_not_marshalled": "error", + "can_be_marshalled": false, + "must_be_marshalled": true + }, + { + "package": "data.table", + "type": "data.table", + "if_not_marshalled": "", + "can_be_marshalled": true, + "must_be_marshalled": false + }, + { + "package": "DBI", + "type": "DBIConnection", + "if_not_marshalled": "error", + "can_be_marshalled": false, + "must_be_marshalled": true + }, + { + "package": "inline", + "type": "CFunc, et al.", + "if_not_marshalled": "error", + "can_be_marshalled": false, + "must_be_marshalled": true + }, + { + "package": "keras", + "type": "keras.engine.training.Model", + "if_not_marshalled": "error", + "can_be_marshalled": true, + "must_be_marshalled": true + }, + { + "package": "magick", + "type": "magick-image", + "if_not_marshalled": "error", + "can_be_marshalled": false, + "must_be_marshalled": true + }, + { + "package": "ncdf4", + "type": "ncdf4", + "if_not_marshalled": "", + "can_be_marshalled": false, + "must_be_marshalled": true + }, + { + "package": "parsnip", + "if_not_marshalled": "", + "can_be_marshalled": true, + "must_be_marshalled": true + }, + { + "package": "raster", + "type": "RasterLayer", + "if_not_marshalled": "???", + "can_be_marshalled": false + }, + { + "package": "Rcpp", + "type": "function", + "if_not_marshalled": "error", + "can_be_marshalled": false, + "must_be_marshalled": true + }, + { + "package": "reticulate", + "type": "python.builtin.object", + "if_not_marshalled": "error", + "can_be_marshalled": false, + "must_be_marshalled": true + }, + { + "package": "rJava", + "type": "jclassName, jobjRef", + "if_not_marshalled": "error", + "can_be_marshalled": false, + "must_be_marshalled": true + }, + { + "package": "rstan", + "type": "stanfit", + "if_not_marshalled": "", + "can_be_marshalled": true, + "must_be_marshalled": false + }, + { + "package": "sparklyr", + "type": "tbl_spark", + "if_not_marshalled": "error", + "can_be_marshalled": false, + "must_be_marshalled": true + }, + { + "package": "terra", + "type": "SpatVectortype, SpatRaster", + "if_not_marshalled": "error", + "can_be_marshalled": true, + "must_be_marshalled": true + }, + { + "package": "udpipe", + "type": "udpipe_model", + "if_not_marshalled": "error", + "can_be_marshalled": false, + "must_be_marshalled": true + }, + { + "package": "xgboost", + "type": "xgb.DMatrix", + "if_not_marshalled": "incorrect result", + "can_be_marshalled": false, + "must_be_marshalled": true + }, + { + "package": "XML", + "type": "XMLInternalDocument, XMLInternalNode", + "if_not_marshalled": "segmentation fault", + "can_be_marshalled": true, + "must_be_marshalled": true + }, + { + "package": "xml2", + "type": "xml_document, xml_nodesettype, xml_node", + "if_not_marshalled": "error", + "can_be_marshalled": true, + "must_be_marshalled": true + }, + { + "package": "ShortRead", + "type": "FastqStreamer", + "if_not_marshalled": "error", + "can_be_marshalled": false, + "must_be_marshalled": true + }, + { + "package": "polars", + "type": "RPolarsDataFrame, et al.", + "if_not_marshalled": "error", + "can_be_marshalled": false, + "must_be_marshalled": true + } +] diff --git a/man/marshal-package.Rd b/man/marshal-package.Rd index 300719e..9318294 100644 --- a/man/marshal-package.Rd +++ b/man/marshal-package.Rd @@ -7,3 +7,16 @@ \description{ Some types of R objects can be used only in the R session they were created. If used as-is in another R process, such objects often result in an immediate error or in obscure and hard-to-troubleshoot outcomes. Because of this, they cannot be saved to file and re-used at a later time. They can also not be exported to a worker in parallel processing. These objects are sometimes referred to as non-exportable or non-serializable objects. One solution to this problem is to use "marshalling" to encode the R object into an exportable representation that then can be used to re-create a copy of that object in another R process. This package provides a framework for marshalling and unmarshalling R objects such that they can be transferred using functions such as \code{serialize()} and \code{unserialize()} of base R. } +\seealso{ +Useful links: +\itemize{ + \item \url{https://marshal.futureverse.org} + \item \url{https://github.com/HenrikBengtsson/marshal} + \item Report bugs at \url{https://github.com/HenrikBengtsson/marshal/issues} +} + +} +\author{ +\strong{Maintainer}: Henrik Bengtsson \email{henrikb@braju.com} [copyright holder] + +} diff --git a/vignettes/known_cases.Rmd b/vignettes/known_cases.Rmd new file mode 100644 index 0000000..a697fe4 --- /dev/null +++ b/vignettes/known_cases.Rmd @@ -0,0 +1,24 @@ +--- +title: "Known Cases where Marshalling is Needed and not" +output: rmarkdown::html_vignette +vignette: > + %\VignetteEngine{knitr::rmarkdown} + %\VignetteIndexEntry{Known Cases where Marshalling is Needed and not} + %\VignetteEncoding{UTF-8} +--- + + +```{r, echo = FALSE} +known_cases <- system.file("known_cases.json", package = "marshal") +support <- jsonlite::read_json(known_cases, simplifyVector = TRUE) +support <- lapply(support, FUN = function(x) { + if (is.logical(x)) c("no", "yes")[x+1] else x +}) +support <- as.data.frame(support) +names <- colnames(support) +names <- gsub("_marshalled", "_marshalled?", names) +names <- gsub("_", " ", names) +names <- gsub("_", " ", names) +colnames(support) <- names +DT::datatable(support, options = list(pageLength = 50)) +```