The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum for Programming
 LabTalk Forum
 Group data with colstats function
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

robbcc

2 Posts

Posted - 06/09/2023 :  09:02:23 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Ver. and Service Release (Select Help-->About Origin): OriginPro 2018
Operating System: Windows 10 Pro

Hi,

I want to calculate the statistics of different columns by grouping the data according to a reference column. With the user interface, I can easily do that with the "Group" option inside the "Statistics on Column" dialog (as shown in the next image).



Is it possible to achieve the same result with the "colstats" function? I would imagine it should be something as follows:


Range inputdat = [StatsCol]input!;
Range colref = [StatsCol]input!wcol(1);
Range colout = [StatsCol]output!wcol(1);

colstats inputdat ref:=colref col:=<none> mean:=<none> sd:=<none> median:=colout n:=<none> max:=<none> min:=<none>;


However, the "ref" variable does not work for this function, and I do not find any equivalent variable in the variables list of https://www.originlab.com/doc/en/X-Function/ref/colstats . In other words, I need a variable like "ref" for "colsplit" function or "irng2" for "wunstackcol" function, but that works for "colstats" function. Does it exists?

I also tried the alternative proposed in here: https://www.originlab.com/doc/LabTalk/Tutorials/Tutorial-Statistics#Statistics_on_columns_with_grouping . However, this option generates a report in a new sheet every time that it calculates the statistics, and i would like to have the output data (calculated statistics) in a specific sheet defined by me.

I am new both in this Forum and in working with LabTalk, so I am sorry if I am asking something basic or that it has already been answered before. I already serached in this Forum and in the OriginLab guides and I did not find the solution.

Thanks in advance for any help

ChaoC

USA
174 Posts

Posted - 06/09/2023 :  11:45:15 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hello,

You can unstack your data first with something like:

wunstackcol -r 2 irng1:=[Book1]Sheet1!D:G irng2:=[Book1]Sheet1!A sort:=data pos:=append;

Then you can just use colstats on the unstacked data.


Best,
Chao
Go to Top of Page

robbcc

2 Posts

Posted - 06/23/2023 :  04:35:14 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,

Understood. I wanted to do all by just using colstats function, but I see that I need to use wunstackcol too.

Thank you very much, ChaoC!

Best regards,

robbcc
Go to Top of Page

paulinasayre

USA
1 Posts

Posted - 06/27/2023 :  10:00:48 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thank you very much. Now it works.

....
Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000