code: def circ_r(alpha, w=None, d=None, axis=0):
      
      alpha = np.array(alpha)
      w = np.array(w) if w is not None else np.ones(alpha.shape)
      if alpha.size is not w.size:
          raise ValueError("Input dimensions do not match")
  
      # Compute weighted sum of cos and sin of angles:
      r = np.multiply(w, np.exp(1j * alpha)).sum(axis=axis)
  
      # Obtain length:
      r = np.abs(r) / w.sum(axis=axis)
  
      # For data with known spacing, apply correction factor
      if d is not None:
          c = d / 2 / np.sin(d / 2)
          r = c * r
  
      return r
docs: Mean resultant vector length for circular data.
  
      Parameters
      ----------
      alpha : array
          Sample of angles in radians
      w : array
          Number of incidences in case of binned angle data
      d : float
          Spacing (in radians) of bin centers for binned data. If supplied,
          a correction factor is used to correct for bias in the estimation
          of r.
      axis : int
          Compute along this dimension
  
      Returns
      -------
      r : float
          Mean resultant length
  
      Notes
      -----
      The length of the mean resultant vector is a crucial quantity for the
      measurement of circular spread or hypothesis testing in directional
      statistics. The closer it is to one, the more concentrated the data
      sample is around the mean direction (Berens 2009).
  
      Examples
      --------
      Mean resultant vector length of circular data
  
      >>> from pingouin import circ_r
      >>> x = [0.785, 1.570, 3.141, 0.839, 5.934]
      >>> circ_r(x)
      0.49723034495605356