I love R Markdown but have hit something I've never hit before. Two snippets of line code show the result 0 when they should show 93 and 40.4. If I run the code blocks above them and copy the code from the inline snippets into the console, I get the answers I expect. Here's a screenshot:
Here's what the Markdown comes out with:
"Ethnicity is a mess with 18 missing, 1 coded as “N/A” and 6 coded “NOT STATED”. There were 0 0 coded as “WHITE - BRITISH”, i.e. 0% 0 so I think there is fun to be had here but clearly ethnicity is going to need cleaning. I was assuming that those are the MDS stipulated categories but thinking about what I’m seeing I’m not so sure." The 18, 1 and 6 are correct but then the inline code is just giving zero not the correct answers. I've tried restarting Rstudio (after clearing the cache and files directories: same. I've tried moving the snippets: same. I've tried swapping single quotes for full quotation marks: same. As you see (if that screenshot worked), I've even tried pre-computing the values and using inline snippets that just call the values: same. Anyone seen this before? Any ideas?