Imaginary units of complex numbers dropped by 'knitr'
1
0
Entering edit mode
Andrzej Oleś ▴ 750
@andrzej-oles-5540
Last seen 3.5 years ago
Heidelberg, Germany
Hi, I came across a strange issue in 'knitr' with R code containing complex numbers entered directly using the "x + yi" notation. For an illustration see the minimal example: http://goo.gl/Yj77kI The sample code evaluates correctly, both in R console and as a code chunk when compiled with Sweave, resulting in: > 1i^2 [1] -1+0i However, when trying to use 'knitr' on the same document, the imaginary unit seems to get lost and what I get is: 1^2 ## [1] 1 Any ideas? Cheers, Andrzej [[alternative HTML version deleted]]
• 686 views
ADD COMMENT
0
Entering edit mode
Andrzej Oleś ▴ 750
@andrzej-oles-5540
Last seen 3.5 years ago
Heidelberg, Germany
Those interested in this issue will find a follow up on stackoverflow: http://stackoverflow.com/questions/18876204/imaginary-units-of- complex-numbers-dropped-by-knitr Briefly, the observed behaviour is related to an upstream bug in getParseData(), which should be fixed in the first R-patched following the release of R-3.0.2, as announced by Duncan Murdoch. Cheers, Andrzej On Wed, Sep 18, 2013 at 12:41 PM, Andrzej Ole¶ <andrzej.oles@gmail.com>wrote: > Hi, > I came across a strange issue in 'knitr' with R code containing complex > numbers entered directly using the "x + yi" notation. For an illustration > see the minimal example: http://goo.gl/Yj77kI > > The sample code evaluates correctly, both in R console and as a code chunk > when compiled with Sweave, resulting in: > > 1i^2 > [1] -1+0i > > However, when trying to use 'knitr' on the same document, the imaginary > unit seems to get lost and what I get is: > 1^2 > ## [1] 1 > > Any ideas? > > Cheers, > Andrzej > [[alternative HTML version deleted]]
ADD COMMENT

Login before adding your answer.

Traffic: 858 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6