Choose Language Hide Translation Bar
Highlighted
axcelenator1
Level III

Pass a variable that is a column name to a Variability chart Y X

Hello, 
I have a stacked data which columns are names like that: 
Label Data , Label 2 Data 2, Label 3 Data 3 ... Label N Data N 
I try to force a variability chart to every Label & its Data via a for loop. But my problem is how to pass a changing var(that is the name of the column) to Y and X . 
This is part of my Code: 

 

test_list ={test1, test2, test3};
ColList = dt << get column names( string, numeric ); show(ColList); dt << Stack( columns( ColList ), Source Label Column( "Label" ), Stacked Data Column( "Data" ), Number of Series( 3 ), Contiguous ); For(k=1,k<=Length(test_list),k++, Variability Chart( Y( :Data ), //<<<<<<---------------------Here I try TODO something like Y(:(test_list[k]))... X( :Label ),//<<<<<<---------------------Here I try TODO something like X(:(test_list[k]))...

Max Iter( 100 ), Conv Limit( 0.00000001 ), Number Integration Abscissas( 128 ), Number Function Evals( 65536 ), Analysis Type( Name( "Choose best analysis (EMS REML Bayesian)" ) ), Connect Cell Means( 1 ), Std Dev Chart( 0 ), Points Jittered( 1 ), AIAG Labels( 0 ) ) );


 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
txnelson
Super User

Re: Pass a variable that is a column name to a Variability chart Y X

All you have to do is to generate the column names you want for each of the iterations.  See the code below for one way to do this:

test_list = {test1, test2, test3};
ColList = dt << get column names( string, numeric );
Show( ColList );
dt << Stack(
	columns( ColList ),
	Source Label Column( "Label" ),
	Stacked Data Column( "Data" ),
	Number of Series( 3 ),
	Contiguous
);

For( k = 1, k <= Length( test_list ), k++,
	If( k = 1, countVar = "", countVar = char( k ) );
	Variability Chart(
		Y( As Column( "Data" || countVar ), //<<<<<<---------------------Here I try TODO something like Y(:(test_list[k]))...
		X( As Column( "Label" || countVar ), //<<<<<<---------------------Here I try TODO something like X(:(test_list[k]))...
		Max Iter( 100 ),
		Conv Limit( 0.00000001 ),
		Number Integration Abscissas( 128 ),
		Number Function Evals( 65536 ),
		Analysis Type(
			Name( "Choose best analysis (EMS REML Bayesian)" )
		),
		Connect Cell Means( 1 ),
		Std Dev Chart( 0 ),
		Points Jittered( 1 ),
		AIAG Labels( 0 )
	)
);
Jim

View solution in original post

1 REPLY 1
Highlighted
txnelson
Super User

Re: Pass a variable that is a column name to a Variability chart Y X

All you have to do is to generate the column names you want for each of the iterations.  See the code below for one way to do this:

test_list = {test1, test2, test3};
ColList = dt << get column names( string, numeric );
Show( ColList );
dt << Stack(
	columns( ColList ),
	Source Label Column( "Label" ),
	Stacked Data Column( "Data" ),
	Number of Series( 3 ),
	Contiguous
);

For( k = 1, k <= Length( test_list ), k++,
	If( k = 1, countVar = "", countVar = char( k ) );
	Variability Chart(
		Y( As Column( "Data" || countVar ), //<<<<<<---------------------Here I try TODO something like Y(:(test_list[k]))...
		X( As Column( "Label" || countVar ), //<<<<<<---------------------Here I try TODO something like X(:(test_list[k]))...
		Max Iter( 100 ),
		Conv Limit( 0.00000001 ),
		Number Integration Abscissas( 128 ),
		Number Function Evals( 65536 ),
		Analysis Type(
			Name( "Choose best analysis (EMS REML Bayesian)" )
		),
		Connect Cell Means( 1 ),
		Std Dev Chart( 0 ),
		Points Jittered( 1 ),
		AIAG Labels( 0 )
	)
);
Jim

View solution in original post

Article Labels

    There are no labels assigned to this post.