cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
The Discovery Summit 2025 Call for Content is open! Submit an abstract today to present at our premier analytics conference.
See how to use to use Text Explorer to glean valuable information from text data at April 25 webinar.
Choose Language Hide Translation Bar
View Original Published Thread

How to work with R tibble objects

JHX
JHX
Level I

I 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();
3 REPLIES 3
peng_liu
Staff


Re: How to work with R tibble objects

I think the problem is caused by NA in the first column. JMP does not know 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.

JHX
JHX
Level I


Re: How to work with R tibble objects

thank 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

issue_tibble_2.PNG

peng_liu
Staff


Re: How to work with R tibble objects

I am not sure what third party interfacing with R can do. If I remember correctly, NA in R is a specially encoded double precision number, so it does not align well with other elements in the same vector in memory in this case. Please contact support@jmp.com in case there is a better solution.