Is there a way to display:
- The total number of inputs in an aggregated list
- The number of inputs that meet a certain criteria, i.e. >0
I managed to take copy someone else’s activity to create a dotplot aggregated from class data. What I would like to do next is have a 3rd screen display the two things listed above so that students can calculate proportions. My search so far has indicated it would need to be done in a graph, but I can’t figure out what the specific commands in the graph need to be.
For the first one, if your aggregated list is L
then length(L)
gives you the total number of inputs!
In the same way you can put specific indices into square brackets and pull out individual elements from a list, you can put a condition to filter the list: L[L>0]
will be all entries of L
where L>0
is true. Wrap that in a length
, and you have the number of inputs that are positive!
(Alternatively, you could straight calculate total({L>0:1,0})
, but I’m a fan of filtering.)
1 Like
Thanks, that was perfect!