Javascript String Right Substring Function In R Studio