I ran into a strange problem in "knitr" with an R code containing complex numbers entered directly using the notation "x + yi". For an illustration, see the Minimum Example: http://goo.gl/Yj77kI
The sample code is correctly evaluated both in the R-console and as a code fragment when compiling with Sweave, resulting in:
> 1i^2 [1] -1+0i
However, trying to use 'knitr' in the same document, the imaginary unit seems to be lost, and I get:
1^2
Any ideas?
Cheers, Andrzej
SessionInfo()
output:
R version 3.0.0 (2013-04-03) Platform: x86_64-unknown-linux-gnu (64-bit) locale: [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8 LC_MONETARY=en_US.UTF-8 [6] LC_MESSAGES=en_US.UTF-8 LC_PAPER=C LC_NAME=C LC_ADDRESS=C LC_TELEPHONE=C [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C attached base packages: [1] stats graphics grDevices utils datasets methods base other attached packages: [1] knitr_1.4.1 loaded via a namespace (and not attached): [1] digest_0.6.3 evaluate_0.4.7 formatR_0.9 highr_0.2.1 stringr_0.6.2 tools_3.0.0
aoles source share