- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
How to write a script to standardise attributes of columns from a generic data table?
I am trying to write a script which standardises attributes from a generic data table. However, I getting the error "Argument must contain data table in access or evaluation on 'Current Data Table', Current Data Table*###*/(dt_trinean). Does anyone know hoe to fix this error?
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: How to write a script to standardise attributes of columns from a generic data table?
the only variable you're giving to the local block is old dt. Then you're using dt_trinean. Instead of switching current datatables, it's often better to scope the data table expicitly.
Names default to here( 1 );
dt = open("$SAMPLE_DATA\Big Class.jmp");
dt2 = New Table("Example", New Column("Thing", numeric, <<Set Values([1, 2, 3])));
print(current data table()); // DataTable("Example")
foreach({col, index},
{dt:height, Column(dt, "weight"), // I'm telling it to use the dt table instead of dt2 (the current data table)
dt2:thing // can even switch data tables in the middle no problem.
},
col << datatype(Character);
// then you don't have to change data tables back either
);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: How to write a script to standardise attributes of columns from a generic data table?
the only variable you're giving to the local block is old dt. Then you're using dt_trinean. Instead of switching current datatables, it's often better to scope the data table expicitly.
Names default to here( 1 );
dt = open("$SAMPLE_DATA\Big Class.jmp");
dt2 = New Table("Example", New Column("Thing", numeric, <<Set Values([1, 2, 3])));
print(current data table()); // DataTable("Example")
foreach({col, index},
{dt:height, Column(dt, "weight"), // I'm telling it to use the dt table instead of dt2 (the current data table)
dt2:thing // can even switch data tables in the middle no problem.
},
col << datatype(Character);
// then you don't have to change data tables back either
);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: How to write a script to standardise attributes of columns from a generic data table?
Thanks, it worked by modifying the script as below:
Local( {dt_trinean_lst = Current Data Table()},
Current Data Table( dt_trinean_lst );
For Each( {col, index},
{:"A280 Concentration(mg/ml)"n, :"AvgA280 Concentration (mg/ml)"n,
:"CVA280 Concentration (%)"n},
col << Data Type( Numeric ) << Set Modeling Type( "Continuous" ) <<
Set Field Width( 12 )
);
Current Data Table( dt_trinean_lst );
);
Now I want to get the summary of replicates on the concatenated table dt_trinean_lst. The code below throws this error, could you tell why and how to fix it?
dt_trinean_summary=dt_trinean_lst << Summary(
Group( :Sample name ),
Mean( :"A280 Concentration(mg/ml)"n ),
Mean( :"AvgA280 Concentration (mg/ml)"n ),
Mean( :"CVA280 Concentration (%)"n ),
Freq( "None" ),
Weight( "None" ),
Link to original data table( 0 )
);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: How to write a script to standardise attributes of columns from a generic data table?
because it's a local variable so once you leave the local block. that var doesn't exist anymore.
For example. This will fail after printing. "inside local = 14"
Names default to here(1);
open log();
Local({x=14},
print("inside local = "||char(x))
);
print("outside local = "||char(x));