How to work with R tibble objectsI really like integrating R code in JSL, but how can I deal with the correct handling of a tibble (dplyr) object. It seems like the object is damaged, when displayed in JMP. The output on my PC is visible in the appended image.
R Init();
R Submit("library(dplyr)");
x = R Execute({},{data_table},"\[
data_table <- tibble(x = c("A", NA, "B", "C"), y = c("D", "E", "F", "G"))
]\"
);
data_table << New Data View();
Show(data_table);
R Term();ScriptingRe: How to work with R tibble objectsI think the problem is caused by NA in the first column. JMP does not how to deal with it. I don't think that JMP differentiates an empty string from a missing value in a Character column. You may consider changing NA to an empty string or some special string, if that works for you.
Re: How to work with R tibble objectsthank you peng_liu, at least it works. I was not aware that the big dot indication missing values in JMP is only for the numbers and character do not have NA values. I still hope for an better NA handling in the JSL/R interface in comming versions.
R Init();
R Submit("
library(dplyr)
library(tidyr)
");
x = R Execute({},{data_table},"\[
data_table <- tibble(x = c(1, NA, 2, 3), y = c("D", "E", "F", "G"), z = c("A", NA, "B", "C"), a = c("H", "I", "J", "K")) %>%
mutate(across(where(is.character), ~replace_na(.x, "")))
data_table
]\"
);
data_table << New Data View( );
//limits << New Data View();
Show(data_table);
R Term(); //Exit