tree function in r package