See if this bit of JSL will give you what you want, or at least a starting point. I had to make a couple of data assumptions, but it may work for you
Names Default To Here( 1 );
dt = New Table( "Example",
Add Rows( 21 ),
New Script(
"Source",
Data Table( "Untitled 29" ) << Transpose(
columns( :Column 1 ),
By( :Column 2 ),
Output Table( "Transpose of Untitled 29" )
)
),
New Column( "Sensor",
Character,
"Nominal",
Set Values(
{"A", "A", "A", "A", "A", "A", "A", "B", "B", "B", "B", "B", "B", "B",
"C", "C", "C", "C", "C", "C", "C"}
)
),
New Column( "Week",
Numeric,
"Ordinal",
Format( "Best", 12 ),
Set Values(
[1, 2, 3, 4, ., ., ., 1, 2, 3, 4, ., ., ., 1, 2, 3, 4, ., ., .]
)
),
New Column( "DoW",
Character,
"Nominal",
Set Values(
{"", "", "", "Sun(D)", "Sun(N)", "Mon(D)", "Mon(N)", "", "", "",
"Sun(D)", "Sun(N)", "Mon(D)", "Mon(N)", "", "", "", "Sun(D)", "Sun(N)",
"Mon(D)", "Mon(N)"}
)
),
New Column( "Value",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Values(
[0.25, 0.33, 0.76, 0.21, 0.75, 0.33, 0.34, 0.6, 0.82, 0.55, 0.4, 0.22,
0.91, 0.98, 0.25, 0.35, 0.76, 0.21, 0.75, 0.33, 0.34]
)
)
);
wait(5); // wait so you can see the original data table
dt << New Column( "The Date",
Character,
"Nominal",
Formula(
dowInclude = "";
If( Is Missing( :Week ) == 0,
theInclude = Char( :Week )
);
If( :DoW != "",
dowInclude = Word( 1, :DoW, "(" )
);
Trim( "Week" || theInclude || " " || dowInclude );
),
Set Selected,
Set Display Width( 83 )
);
wait(5); // wait so you can see the new formula generated column
// Create the means
dtSum = dt << Summary(
invisible,
Group( :Sensor, :The Date ),
Mean( :Value ),
Freq( "None" ),
Weight( "None" ),
statistics column name format( "column" ),
Link to original data table( 0 )
);
// Split the table into the Final Display Format
dtFinal = dtSum << Split(
Split By( :The Date ),
Split( :Value ),
Group( :Sensor ),
Remaining Columns( Drop All ),
Sort by Column Property
);
// Clean up
close( dtSum, nosave );Thanks for your response.I have already tried this approach.But the problem is the column names are in the format Value,week,day and renaming them is tricky because the column names change with change in week and day.
Is there any other option I can try/read up about?
You would use the summary table platform to do this with two Subgroup variables.
First you would need to strip out the extra characters from the DoW values and then perform the Summary so for example:
New Column( "Day", Character, "Nominal", Formula( Substr( :DoW, 1, 3 )));
Summary(
Group( :Sensor ),
Mean( :Value ),
Subgroup( :Week, :Day ),
Freq( "None" ),
Weight( "None" )
);