Dear Community
first best wishes for good health!
i need to add summary statistic for a data table with a grouping variable. i want the summary statistic to appear in every row that the matching grouping variable appears.
what i've done until now is to create a separate summary statistic table and then manually recode the grouping variable column. this is a bit tedious. is there a way to just merge the recode and summary table?
see pics
Thank you
Is this what you are after? Do 'File > New Script', copy and paste the code below, then 'Edit > Run Script'.
NamesDefaultToHere(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");
dt << New Column( "Mean weight Grouped by age", Formula( Col Mean( :weight, :age ) ) );
If so, take a look at the formula column in the table. Using 'Help > Scripting Index' gives some other possibilities:
Is this what you are after? Do 'File > New Script', copy and paste the code below, then 'Edit > Run Script'.
NamesDefaultToHere(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");
dt << New Column( "Mean weight Grouped by age", Formula( Col Mean( :weight, :age ) ) );
If so, take a look at the formula column in the table. Using 'Help > Scripting Index' gives some other possibilities:
I am not accomplishing the task
Here is the output of the summary table script:
Tabulate(
Add Table( Column Table( Analysis Columns( :OTU ) ), Row Table( Grouping Columns( :Plot and replicate ) ) )
)
It gives me the exact statistic that i need in one row per grouping variable. now i need it to repeat for each row with the grouping variable (and i have 73000 rows!)
anyway i am new to scripting so pardon my obvious lack of experience
@ian_jmp gave you an example of what you need to use, he just didn't put it into the specifics of your data table. So if you run this little script, against your data table, it should give you what you want.
Names Default To Here( 1 );
dt = Current Data Table();
dt << New Column( "Mean OTU Grouped by Plot and replicate",
formula( Col Mean( :OTU, :Plot and replicate ) ) );