Share your ideas for the JMP Scripting Unsession at Discovery Summit by September 17th. We hope to see you there!
Choose Language Hide Translation Bar
Highlighted
mallen810
Level III

Change column name within previous script

I am trying to change column names from data that I have already brought in from a database. The columns currently are labeled with numbers and I would like to give them names. Below is the current data table script. Thanks in advance for your help.

 

Data Table( "100 conveyor data112018.jmp" ) <<

Summary(

Group( :Date, :Time ),

Mean( :Name( "1" )),

Mean( :Name( "6" ) ),

Mean( :Name( "19" ) ),

Mean( :Name( "20" ) ),

Freq( "None" ),

Weight( "None" ))

1 REPLY 1
Highlighted
txnelson
Super User

Re: Change column name within previous script

Here are a couple of variations on the question you are asking

dt = Data Table( "100 conveyor data112018.jmp" );

dt:Name( "1" ) << set name( "New Name 1" );
dt:Name( "6" ) << set name( "New Name 2" );
dt:Name( "19" ) << set name( "New Name 3" );
dt:Name( "20" ) << set name( "New Name 4" );

dt2 = dt << Summary(
	Group( :Date, :Time ),
	Mean( :Name( "New Name 1" ) ),
	Mean( :Name( "New Name 2" ) ),
	Mean( :Name( "New Name 3" ) ),
	Mean( :Name( "New Name 4" ) ),
	Freq( "None" ),
	Weight( "None" )
)
;

// or

dt2 = Data Table( "100 conveyor data112018.jmp" ) <<
Summary(
Group( :Date, :Time ),
Mean( :Name( "1" )),
Mean( :Name( "6" ) ),
Mean( :Name( "19" ) ),
Mean( :Name( "20" ) ),
Freq( "None" ),
Weight( "None" ));

dt2:Name("Mean(1)") << set name( "New Name 1" );
dt2:Name("Mean(6)") << set name( "New Name 2" );
dt2:Name("Mean(19)") << set name( "New Name 3" );
dt2:Name("Mean(20)") << set name( "New Name 4" ); 

I suggest that you spend some time reading the Scripting Guide, which will give you all of the background on the language structures and the syntax on how to deal with them.

     Help==>Books==>Scripting Guide

Jim
Article Labels

    There are no labels assigned to this post.