I'm able to read in a script file but in rmd.
Where is you text file relative to the Rmd document ?
From your code, it should be in the same folder. You could consider the here package to help otherwise.
The error is not a R Markdown error so there is something related with how