R Markdown could not find function