- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Adding new columns to a data table
i create a table and try add two aolumns in jsl as follows:
Test = New Table( "Test" );
Test << New Column( "Ident", Character, Continuous, Format( "Best", 8 ), set values( identifiers ) );
Test << New Column( "Value", Numeric, Continuous, Format( "Best", 8 ), set values( values ) );
identifiers - is a list of caharacters
values - a a list of matching numbers.
using the format above, creates only ident column , populates with values and stops before adding the second column. no report of an error.
(if i run the command latter manually it adds also Value column and the values.
if i use a slightly different format (below), no issues and both columns are created and populated with the values:
Test=new table("Test");
Test<<new column("Value",Numeric,Continuous,format("Best",8),set values(values));
Test<<new column("Ident",Character,Continuous,format("Best",8),set values(identifiers));
any explanation to this behavior?
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Adding new columns to a data table
A column that has is of Data Type, "Character", can only have a Modeling Type of "Nominal". Also, a Format definition for a Character column can not be specified. The script below is a modification of your script that runs without error
Names Default To Here( 1 );
identifiers = {"a", "b", "c"};
values = {1, 2, 3};
Test = New Table( "Test" );
Test <<
New Column( "Ident",
Character,
set values( identifiers )
);
Test <<
New Column( "Value",
Numeric,
Continuous,
Format( "Best", 8 ),
set values( values )
);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Adding new columns to a data table
A column that has is of Data Type, "Character", can only have a Modeling Type of "Nominal". Also, a Format definition for a Character column can not be specified. The script below is a modification of your script that runs without error
Names Default To Here( 1 );
identifiers = {"a", "b", "c"};
values = {1, 2, 3};
Test = New Table( "Test" );
Test <<
New Column( "Ident",
Character,
set values( identifiers )
);
Test <<
New Column( "Value",
Numeric,
Continuous,
Format( "Best", 8 ),
set values( values )
);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Adding new columns to a data table
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Adding new columns to a data table
Hi @txnelson,
Thanks for your help.
2nd file doesn't have Minimum Age Column. How can I create the 2nd column with name "Minimum Age" and then run the above script?