Is it possible to print the content of a file (supporting extensions like r,tex,txt,rnw) using R?
Reproducible file:
sink('myFile')
cat('\nThis is some text')
cat('\n')
cat('\nEnd of file')
sink()
Now I am looking for a function in R that prints the content of R as…
>PRINT_FILE_CONTENT('myFile')
This is some text
End of file
>
I hope I am clear. I will appreciate any help?
This seems to work:
although I did get
at the end … you could wrap it in
suppressWarnings()if you like.