cumlativeSumInCategory [message #1294] |
Wed, 19 May 2021 15:56 |
chemtv
Messages: 26 Registered: February 2015 Location: Indianapolis
|
Junior Member |
|
|
I am trying to use a calculated column to sum the values per a text category but I keep getting "NaN" as the result. Can you tell what the problem is?
Attached is an example table...
The formula that gives NAN is:
cumulativeSumInCategory(plateID,"penalties")
I am expecting a new column that has the sum 14 for the first 3 entries and 7 for the second 3 entries, (same number for each of 3 rows).
BTW, I have no success with frequencyInCategory either. Can the frequency count unique text strings (eg. SMILES) as well as numbers?
Thanks,
Greg
-
Attachment: Example.dwar
(Size: 1.19KB, Downloaded 351 times)
[Updated on: Wed, 19 May 2021 15:58] Report message to a moderator
|
|
|
Re: cumlativeSumInCategory [message #1296 is a reply to message #1294] |
Fri, 21 May 2021 00:40 |
nbehrnd
Messages: 224 Registered: June 2019
|
Senior Member |
|
|
Dear Greg,
the computation fails because the instruction contains an error in the syntax. In your example, plateID and penalties are not variables, but label-like column headers. For this reason both are to be enclosed in quotes. To enable a computation, the formula thus shall be written as
cumulativeSumInCategory("plateID", "penalties")
Note, `cumulativeSumInCategory` adds line by line the penalties for the plateIDs, and accounts for all lines already scrutinized. This pattern is used in column «freq3» in the example attached below.
Your description of the anticipated results differs from this, though. It is better described by the formula categorySum("plateID", "penalties") This pattern is used in column «freq4»:
Norwid
-
Attachment: summation.png
(Size: 48.13KB, Downloaded 480 times)
-
Attachment: probe.dwar
(Size: 1.86KB, Downloaded 329 times)
|
|
|
|