Skip to content

Commit

Permalink
fix(R microkernel): Unbox string outputs
Browse files Browse the repository at this point in the history
This avoids plain text representations of objects being returned as JSON
arrays with a single string item.
  • Loading branch information
nokome committed Dec 6, 2021
1 parent 5523797 commit d8760ce
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions rust/kernel-r/src/r-codec.r
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ convert_value <- function(value, options = list()) {
} else if (inherits(value, "table")) {
# The functions `summary` and `table` return class "table" results
# Currently, just "print" them. In the future, we may convert these to Datatables.
paste(utils::capture.output(base::print(value)), collapse = "\n")
unbox(paste(utils::capture.output(base::print(value)), collapse = "\n"))
} else if (is.data.frame(value)) {
# Decode to a Datatable
convert_data_frame(value)
Expand All @@ -45,8 +45,7 @@ convert_value <- function(value, options = list()) {
# to the appropriate JSON type e.g. a matrix to an array of arrays
value
} else {
warning(paste("Default conversion for R type:", typeof(value), ", class:", class(value)))
paste(utils::capture.output(base::print(value)), collapse = "\n")
unbox(paste(utils::capture.output(base::print(value)), collapse = "\n"))
}
}

Expand Down

0 comments on commit d8760ce

Please sign in to comment.