I concur with Jaime's suggestion, but I note that on my system (see
below), I *do* see the effect of the opts_knitset statement. I wonder
if your rmarkdown package is up-to-date. Note, by the way, that you
should be getting the *same* value from `getwd` in both of your print
statements. I.e., there is no "mid-stream" change in its value.
Evidently, rmarkdown scans the file for global options before
rendering the document.
-- Mike
> sessionInfo()
R version 3.3.0 (2016-05-03)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 14.04.4 LTS
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
LC_TIME=en_US.UTF-8
[4] LC_COLLATE=en_US.UTF-8 LC_MONETARY=en_US.UTF-8
LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=en_US.UTF-8 LC_NAME=C
LC_ADDRESS=C
[10] LC_TELEPHONE=C LC_MEASUREMENT=en_US.UTF-8
LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices datasets utils methods base
other attached packages:
[1] rmarkdown_0.9.6
loaded via a namespace (and not attached):
[1] htmltools_0.3.5 Rcpp_0.12.5 digest_0.6.9