[R-sig-teaching] Excluding the zero from a sequence when created

Randall Pruim rpruim at calvin.edu
Thu Nov 26 00:16:44 CET 2015


I don’t think Hadley was challenging whether you teach, just pointing out that general questions about how the R language works are better suited for R-help (and may generate more and faster replies).

But I’ll add a few remarks, about R and about teaching.

1) I’m curious why this function is important.  Are you teaching a statistics class or something else?

2) I don’t think you need to remove 0.  plot(t,y) works just fine without doing the removal.  pi/0 turns into Inf, but doesn’t noticeably affect the plot.  So for students, that removal might just be a distractor from your main point.

3) For plotting functions, you might look at the mosaic package and plotFun().  I’ve been experimenting with heuristics that attempt to detect discontinuities, and your function is pretty pathological, so I have to turn that off.  For most functions, this would not be an issue:

plotFun( cos(pi/t) ~ t, t.lim = c(-1,1), discontinuities = 0, npts = 2000)

plotFun( sin(pi * t) ~ t, t.lim = c( -2, 2))

You can experiment with npts to get as much or little detail around 0 as you think is appropriate.

4) For teaching, the decision between base graphics, lattice, and ggplot2 (and soon ggvis) is an important one to think through.  Depending on the goals of the course, I can imagine good arguments for using lattice or ggplot2.  I don’t find base graphics compelling for teaching and never teach it to my students.

5) If you happen to be teaching calculus, there are a number of things in the mosaic package to support calculus teaching.  I don’t use it for that (I haven’t taught calculus is quite a while now), but the folks at Macalester do and can probably provide you some examples of what they do if you are curious.

—rjp


On Nov 25, 2015, at 5:48 PM, Steven Stoline <sstoline at gmail.com<mailto:sstoline at gmail.com>> wrote:

Dear Hadley:


In fact I am teaching R this semester for undergraduate students. In
addition, I am using R in most of the classes I teach.


with many thanks
steve

On Wed, Nov 25, 2015 at 1:53 PM, Hadley Wickham <h.wickham at gmail.com<mailto:h.wickham at gmail.com>> wrote:

For future reference, this mailing list is about teaching R - you
really should use R-help for such questions.
Hadley

On Thu, Nov 26, 2015 at 1:13 AM, Steven Stoline <sstoline at gmail.com<mailto:sstoline at gmail.com>>
wrote:
Dear All:

How to exclude the zero from this sequence when created.

t<-seq(-1,1,0.01)


Because I want to do the following:


y<-cos(pi/t)

plot(t,y, type="l", col="blue", lwd=1.5)

abline(h=0, col="red", lwd=1.5)


with many thanks
steve


--------------------
Steven M. Stoline
1123 Forest Avenue
Portland, ME 04112
sstoline at gmail.com<mailto:sstoline at gmail.com>

       [[alternative HTML version deleted]]

_______________________________________________
R-sig-teaching at r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-teaching



--
http://had.co.nz/




--
Steven M. Stoline
1123 Forest Avenue
Portland, ME 04112
sstoline at gmail.com<mailto:sstoline at gmail.com>

[[alternative HTML version deleted]]

_______________________________________________
R-sig-teaching at r-project.org<mailto:R-sig-teaching at r-project.org> mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-teaching


	[[alternative HTML version deleted]]



More information about the R-sig-teaching mailing list