Send JMP Column Names to RHI all,
Am I the only one having problems with the R JMP name to R name function in JSL? It works fine for simple names but as soon as you have slightly unusual names in JMP (something with a parenthesis or a greek symbol for example), the name that is returned is not at all the same as the name stored in the R dataframe resulting from the R send(data table) command. Are there any easy solution to this problem short of renaming JMP column names to something simpler??
Many thanks, Yves
Re: Send JMP Column Names to RThanks for your solution. In the meantime, I gave gone a different route to solve the problem using associative arrays. Basically, I send the data table to R and retrieve whatever columns names R decided to give them back into JMP. I then build an associative array between the JMP name and the R names. Something like:
R Send( dt );
R Submit( "Rnames<-names(dt)" );
RnamesinJMP = R Get( Rnames );
aa = Associative Array( JMPnames, RnamesinJMP );
I can then translate any JMP column name into its R equivalent with the <
THankgs again, Yves
Re: Send JMP Column Names to RYou are not the only one; here is a possible workaround:
Names default to here( 1 );
//Send sample data to R
dt = New Table( "Original",
Add Rows( 2 ),
New Column( "Hello (there)",
Numeric, "Continuous", Format( "Best", 12 ),
Set Values( [1, 2, 3] )
),
New Column( "╓ < Greek", Character, "Nominal", Set Values( {"a", "b", "c"} ) )
);
R Init();
R Send(dt);
//Get column names and send them to R
cn = dt << get column names( String );
R Send(cn);
//Set column names
R Submit( "colnames(dt) = cn" );
//Names might not appear to match
R Submit( "print(dt)" );
//But they should return correctly
dtr = R Get(dt) << NewDataView;
dtr << Set name("Returned");
R Term();