An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-sig-teaching/attachments/20130508/6bf8dc07/attachment.pl>
graphing inequalities (intervals) in one varible
7 messages · AbouEl-Makarim Aboueissa, Mattson, Todd, R. Michael Weylandt +2 more
You may want to try the curve function. For example:
curve(x^2,-1,1,xlim=c(-3,5),ylim=c(0,9))
curve(x^2,2,3,add=TRUE)
Todd Mattson
DeVry University
-----Original Message-----
From: r-sig-teaching-bounces at r-project.org [mailto:r-sig-teaching-bounces at r-project.org] On Behalf Of Yahoo!
Sent: Wednesday, May 08, 2013 6:10 AM
To: r-sig-teaching at r-project.org
Subject: [R-sig-teaching] graphing inequalities (intervals) in one varible
Dear All:
It seems a very silly question. But I never tried it before. I am teaching a college algebra class this summer.
I need some help with graphing intervals on the real line. For examples:
{x | -7<= x < 5 and x > 7}
{x | x > 3}
etc...
thank you very much
abou
========================
AbouEl-Makarim Aboueissa
Sozan Elsalakawy
Mohamed Agamia
246 Auburn Street, #158
Portland, ME 04103
USA
Tel: (207) 797-2724
Email: aboueiss at yahoo.com
_______________________________________________
R-sig-teaching at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-teaching
Here's the start of a function. I'll leave it to you to do it better
(it should probably also use S4 methods, but that's another project):
interval <- function(lower = -Inf, upper = Inf, lower_closed = FALSE,
upper_closed = FALSE){
structure(.Data = NULL, lower = lower, upper = upper, lower_closed =
lower_closed, upper_closed = upper_closed, class = 'interval')
}
plot.interval <- function(x){
l <- attr(x, "lower")
u <- attr(x, "upper")
r <- c(l, u) * c(if(l > 0) 0.7 else 1.2, if(u > 0) 1.2 else 0.7)
plot(r, c(0,1), main = '', bty = 'n', xlab = '', ylab = '', yaxt =
'n', type = 'n', xaxt = 'n')
axis(1, at = seq(r[1], r[2], length.out = 10))
lines(c(l, u), c(0.5, 0.5), col = 2, lwd = 2)
lc <- attr(x, 'lower_closed')
uc <- attr(x, 'upper_closed')
points(c(l, u), c(0.5, 0.5), pch = c(1, 19)[c(lc, uc) + 1], col = 2, cex = 2)
}
On Wed, May 8, 2013 at 12:10 PM, Yahoo! <aboueiss at yahoo.com> wrote:
Dear All:
It seems a very silly question. But I never tried it before. I am teaching a college algebra class this summer.
I need some help with graphing intervals on the real line. For examples:
{x | -7<= x < 5 and x > 7}
{x | x > 3}
etc...
thank you very much
abou
========================
AbouEl-Makarim Aboueissa
Sozan Elsalakawy
Mohamed Agamia
246 Auburn Street, #158
Portland, ME 04103
USA
Tel: (207) 797-2724
Email: aboueiss at yahoo.com
[[alternative HTML version deleted]]
_______________________________________________ R-sig-teaching at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-teaching
An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-sig-teaching/attachments/20130509/de9fae0e/attachment.pl>
An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-sig-teaching/attachments/20130509/500e8748/attachment.pl>
On Wed, May 8, 2013 at 7:10 AM, Yahoo! <aboueiss at yahoo.com> wrote:
Dear All:
It seems a very silly question. But I never tried it before. I am teaching a college algebra class this summer.
I need some help with graphing intervals on the real line. For examples:
{x | -7<= x < 5 and x > 7}
{x | x > 3}
etc...
Check out the intervals packages: library(intervals) example(plot.Intervals) -- Statistics & Software Consulting GKX Group, GKX Associates Inc. tel: 1-877-GKX-GROUP email: ggrothendieck at gmail.com
An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-sig-teaching/attachments/20130509/b44c9097/attachment.pl>