I need to replicate this Python code in R.
def freq(array): maximum = count = 0 count = 0 for i in range(1