ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Mon, 22 Oct 2012 21:38:55 +0200May there is a bug in notebookhttps://ask.sagemath.org/question/8946/may-there-is-a-bug-in-notebook/ I'd like to use R in notebook worksheet. I mean, I have the R evaluation chosen at the top, and when I use TAB to call auto completion I do not get correct names.
For example,after I hit "shapiro" and press TAB ,the auto-completion returns "shapiro_test",but in R,this function is "shapiro.test".
Many other function with "." are returned instead of "_".Is there any solution?
Tue, 08 May 2012 11:18:08 +0200https://ask.sagemath.org/question/8946/may-there-is-a-bug-in-notebook/Answer by kcrisman for <p>I'd like to use R in notebook worksheet. I mean, I have the R evaluation chosen at the top, and when I use TAB to call auto completion I do not get correct names. </p>
<p>For example,after I hit "shapiro" and press TAB ,the auto-completion returns "shapiro_test",but in R,this function is "shapiro.test".</p>
<p>Many other function with "." are returned instead of "_".Is there any solution?</p>
https://ask.sagemath.org/question/8946/may-there-is-a-bug-in-notebook/?answer=13553#post-id-13553This is a feature, not a bug! In Python, `.` means a namespace, so we convert dots to underscores. This test should work.
sage: S = r.rnorm(10, mean = 5, sd = 3)
sage: S
[1] 8.252611 7.721551 5.291445 4.129569 -2.235594 1.466262 4.235228 7.557193 3.338087
[10] 10.203015
sage: r.shapiro_test(S)
Shapiro-Wilk normality test
data: sage8
W = 0.9619, p-value = 0.8068
Seems ok.
sage: r_console()
R version 2.14.0 (2011-10-31)
Copyright (C) 2011 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
<snip>
> shapiro.test(rnorm(10, mean = 5, sd = 3))
Shapiro-Wilk normality test
data: rnorm(10, mean = 5, sd = 3)
W = 0.9415, p-value = 0.5698
Tue, 08 May 2012 12:36:05 +0200https://ask.sagemath.org/question/8946/may-there-is-a-bug-in-notebook/?answer=13553#post-id-13553Comment by kcrisman for <p>This is a feature, not a bug! In Python, <code>.</code> means a namespace, so we convert dots to underscores. This test should work.</p>
<pre><code>sage: S = r.rnorm(10, mean = 5, sd = 3)
sage: S
[1] 8.252611 7.721551 5.291445 4.129569 -2.235594 1.466262 4.235228 7.557193 3.338087
[10] 10.203015
sage: r.shapiro_test(S)
Shapiro-Wilk normality test
data: sage8
W = 0.9619, p-value = 0.8068
</code></pre>
<p>Seems ok.</p>
<pre><code>sage: r_console()
R version 2.14.0 (2011-10-31)
Copyright (C) 2011 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
<snip>
> shapiro.test(rnorm(10, mean = 5, sd = 3))
Shapiro-Wilk normality test
data: rnorm(10, mean = 5, sd = 3)
W = 0.9415, p-value = 0.5698
</code></pre>
https://ask.sagemath.org/question/8946/may-there-is-a-bug-in-notebook/?comment=19787#post-id-19787Ah! That was not at *all* clear in the original, but I have edited the original question a little bit to make this clear. I figure that any of the interfaces there will do that, it's an interesting point.Mon, 14 May 2012 13:19:22 +0200https://ask.sagemath.org/question/8946/may-there-is-a-bug-in-notebook/?comment=19787#post-id-19787Comment by kcrisman for <p>This is a feature, not a bug! In Python, <code>.</code> means a namespace, so we convert dots to underscores. This test should work.</p>
<pre><code>sage: S = r.rnorm(10, mean = 5, sd = 3)
sage: S
[1] 8.252611 7.721551 5.291445 4.129569 -2.235594 1.466262 4.235228 7.557193 3.338087
[10] 10.203015
sage: r.shapiro_test(S)
Shapiro-Wilk normality test
data: sage8
W = 0.9619, p-value = 0.8068
</code></pre>
<p>Seems ok.</p>
<pre><code>sage: r_console()
R version 2.14.0 (2011-10-31)
Copyright (C) 2011 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
<snip>
> shapiro.test(rnorm(10, mean = 5, sd = 3))
Shapiro-Wilk normality test
data: rnorm(10, mean = 5, sd = 3)
W = 0.9415, p-value = 0.5698
</code></pre>
https://ask.sagemath.org/question/8946/may-there-is-a-bug-in-notebook/?comment=18836#post-id-18836This is now also https://github.com/sagemath/sagenb/issues/103, though it's unclear whether the problem is in Sage or sagenb.Mon, 22 Oct 2012 21:38:55 +0200https://ask.sagemath.org/question/8946/may-there-is-a-bug-in-notebook/?comment=18836#post-id-18836Comment by kcrisman for <p>This is a feature, not a bug! In Python, <code>.</code> means a namespace, so we convert dots to underscores. This test should work.</p>
<pre><code>sage: S = r.rnorm(10, mean = 5, sd = 3)
sage: S
[1] 8.252611 7.721551 5.291445 4.129569 -2.235594 1.466262 4.235228 7.557193 3.338087
[10] 10.203015
sage: r.shapiro_test(S)
Shapiro-Wilk normality test
data: sage8
W = 0.9619, p-value = 0.8068
</code></pre>
<p>Seems ok.</p>
<pre><code>sage: r_console()
R version 2.14.0 (2011-10-31)
Copyright (C) 2011 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
<snip>
> shapiro.test(rnorm(10, mean = 5, sd = 3))
Shapiro-Wilk normality test
data: rnorm(10, mean = 5, sd = 3)
W = 0.9415, p-value = 0.5698
</code></pre>
https://ask.sagemath.org/question/8946/may-there-is-a-bug-in-notebook/?comment=19721#post-id-19721I've opened http://trac.sagemath.org/sage_trac/ticket/13070 for this, though I'm not sure how easy it would be to fix.Thu, 31 May 2012 15:00:02 +0200https://ask.sagemath.org/question/8946/may-there-is-a-bug-in-notebook/?comment=19721#post-id-19721Comment by shahuwang for <p>This is a feature, not a bug! In Python, <code>.</code> means a namespace, so we convert dots to underscores. This test should work.</p>
<pre><code>sage: S = r.rnorm(10, mean = 5, sd = 3)
sage: S
[1] 8.252611 7.721551 5.291445 4.129569 -2.235594 1.466262 4.235228 7.557193 3.338087
[10] 10.203015
sage: r.shapiro_test(S)
Shapiro-Wilk normality test
data: sage8
W = 0.9619, p-value = 0.8068
</code></pre>
<p>Seems ok.</p>
<pre><code>sage: r_console()
R version 2.14.0 (2011-10-31)
Copyright (C) 2011 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
<snip>
> shapiro.test(rnorm(10, mean = 5, sd = 3))
Shapiro-Wilk normality test
data: rnorm(10, mean = 5, sd = 3)
W = 0.9415, p-value = 0.5698
</code></pre>
https://ask.sagemath.org/question/8946/may-there-is-a-bug-in-notebook/?comment=19788#post-id-19788I know that when calls R with Sage,the dot will convert to underscores.But even when I set the "system" to R with combo box above in notebook,the dot will convert to underscores,and that is the problem.Sun, 13 May 2012 02:29:48 +0200https://ask.sagemath.org/question/8946/may-there-is-a-bug-in-notebook/?comment=19788#post-id-19788