Counting functions
In data exploration, counting over a range is often done. It helps to find out the most/least occurring value. Julia provides the counts function to count over a range. Let's say we have an array of values. For our convenience, we will now use the random function to create an array:
We have created an array of 30 values ranging from 1 to 5. Now we want to know how many times they occur in the dataset:
Using the count
function, we found that 1(7
), 2(1
), 3(5
), 4(11
), and 5(6
). counts take different arguments to suit the use case.
The proportions()
function is used to compute the proportions of the values in the dataset and Julia provides the function:
We calculated proportions on the same dataset that we used in the previous examples. It shows that the ratio of value 1 in the dataset is 0.23333
. This can also be seen as the probability of finding the value in the dataset.
Other count functions include:
countmap(arr)
: This is a map function that maps the values to the number...