Here's a chunk I'm trying to render accurately to pdf, and by "accurately" I mean that it's possible to cut and paste the code from the knitted document and have it execute correctly in the console.
In the example below, the code returns 1 in the knitted output but returns 2 when you cut and paste from the knitted pdf output to the console :
grep('^ab', c('ab', 'd^ab'))
The issue is that the circumflex in the code is ASCII 94, but is rendered to a typographical circumflex when knitted to pdf. It thus loses the interpretation as beginning of string. (It is correctly knitted to html).
Is there some way to control the rendering process so that the output circumflex is also ascii 94?