I work on a large internal R package that could be considered "legacy code." That is, the code is working is always needing updates, new features, and bug fixes. Much of the code is duplicated across function, so much so that I have a hard time identifying which duplicated I should factor out first. Does anyone know of a static code analysis tool that works with R that could help me find this duplicated code?