[R] Plot step function
Hi, I am just starting to learn R, sorry for asking a simple question. How can plot a line x <= 0 y = 0, x > 0 y = 1? Thank you. - j [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] [FORGED] Plot step function
Thank you for the all response, how can the point y (0.0) on the same x axis, and X increases 1 between [-4, 4]? On Sun, Feb 7, 2016 at 5:29 AM, Rolf Turner wrote: > On 07/02/16 01:11, jupiter wrote: > >> Hi, >> >> I am just starting to learn R, sorry for asking a simple question. How can >> plot a line x <= 0 y = 0, x > 0 y = 1? >> > > One way: > > plot(c(-1,0,1),c(0,1,1),type="s",xlab="x",ylab="y") > > cheers, > > Rolf Turner > > -- > Technical Editor ANZJS > Department of Statistics > University of Auckland > Phone: +64-9-373-7599 ext. 88276 > [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] [FORGED] Plot step function
Thanks Jim, that was I did to generate graphic from plot(c(-4,0,4),c(0,1,1),type="s",xlab="x",ylab="y"), it displayed [-4, -2, 0, 2, 4] in X, I tried to twist it, but could not get [-4, -3, -2, -1, 0, 1, 2, 3, 4] in X. Also, that the y 0.0 is above the X axis. I guess I try to figure out if, in general, there are parameters to define Δx (i.e Δx= 1), and to define [0, 0.0] at the joint of x axis and y axis. But never mind, if it is too much to ask :-). Thank you and greatly appreciate kind responses. - j On Mon, Feb 8, 2016 at 8:19 AM, Jim Lemon wrote: > Hail Jupiter, > Might a slight alteration of Rolf's suggestion do the trick? > > plot(c(-4,0,4),c(0,1,1),type="s",xlab="x",ylab="y") > > Jim > > On Sun, Feb 7, 2016 at 8:49 AM, jupiter wrote: > >> Thank you for the all response, how can the point y (0.0) on the same x >> axis, and X increases 1 between [-4, 4]? >> >> On Sun, Feb 7, 2016 at 5:29 AM, Rolf Turner >> wrote: >> >> > On 07/02/16 01:11, jupiter wrote: >> > >> >> Hi, >> >> >> >> I am just starting to learn R, sorry for asking a simple question. How >> can >> >> plot a line x <= 0 y = 0, x > 0 y = 1? >> >> >> > >> > One way: >> > >> > plot(c(-1,0,1),c(0,1,1),type="s",xlab="x",ylab="y") >> > >> > cheers, >> > >> > Rolf Turner >> > >> > -- >> > Technical Editor ANZJS >> > Department of Statistics >> > University of Auckland >> > Phone: +64-9-373-7599 ext. 88276 >> > >> >> [[alternative HTML version deleted]] >> >> __ >> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see >> https://stat.ethz.ch/mailman/listinfo/r-help >> PLEASE do read the posting guide >> http://www.R-project.org/posting-guide.html >> and provide commented, minimal, self-contained, reproducible code. >> > > [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] [FORGED] Plot step function
Thanks Jeff, I've already added color and lwd to make it visible. I know it is not the optimal thing to do, but I was required. Cheers. On Tue, Feb 9, 2016 at 3:11 AM, Jeff Newmiller wrote: > R by default puts the axes at the edge of the plot, not at x=0 and y=0, > for the reason that doing otherwise makes the plot harder to read. To see > this, consider: > > plot( c( -4, 0, 4 ), c( 0, 1, 1 ), type="s", xlab="x", ylab="y", > axes=FALSE, xlim=c( -5, 5 ), ylim=c( -2, 2 ), lwd=2 ) > axis( side=1, at=seq( -4, 4, 1 ), pos=0 ) > axis( side=2, at=seq( -2, 2, 1 ), pos=0 ) > > You should read the help pages > ?plot.default > ?axis > -- > Sent from my phone. Please excuse my brevity. > > On February 7, 2016 2:54:48 PM PST, jupiter wrote: > >> Thanks Jim, that was I did to generate graphic from >> plot(c(-4,0,4),c(0,1,1),type="s",xlab="x",ylab="y"), it displayed [-4, -2, >> 0, 2, 4] in X, I tried to twist it, but could not get [-4, -3, -2, -1, 0, >> 1, 2, 3, 4] in X. Also, that the y 0.0 is above the X axis. >> >> I guess I try to figure out if, in general, there are parameters to define >> Δx (i.e Δx= 1), and to define [0, 0.0] at the joint of x axis and y axis. >> But never mind, if it is too much to ask :-). >> >> Thank you and greatly appreciate kind responses. >> >> - j >> >> >> >> On Mon, Feb 8, 2016 at 8:19 AM, Jim Lemon wrote: >> >> Hail Jupiter, >>> Might a slight alteration of Rolf's suggestion do the trick? >>> >>> plot(c(-4,0,4),c(0,1,1),type="s",xlab="x",ylab="y") >>> >>> Jim >>> >>> On >>> Sun, Feb 7, 2016 at 8:49 AM, jupiter wrote: >>> >>> Thank you for the all response, how can the point y (0.0) on the same x >>>> axis, and X increases 1 between [-4, 4]? >>>> >>>> On Sun, Feb 7, 2016 at 5:29 AM, Rolf Turner >>>> wrote: >>>> >>>> On 07/02/16 01:11, jupiter wrote: >>>>> >>>>> Hi, >>>>>> >>>>>> I am just starting to learn R, sorry for asking a simple question. How >>>>>> >>>>> can >>>> >>>>> plot a line x <= 0 y = 0, x > 0 y = 1? >>>>> >>>>> >>>>> >>>>> One way: >>>>> >>>>> plot(c(-1,0,1),c(0,1,1),type="s",xlab="x",ylab="y") >>>>> >>>>> cheers, >>>>> >>>>> Rolf Turner >>>>> >>>>> -- >>>>> Technical Editor ANZJS >>>>> Department of Statistics >>>>> University of Auckland >>>>> Phone: +64-9-373-7599 ext. 88276 >>>> >>>> >>>> >>>> [[alternative HTML version deleted]] >>>> >>>> -- >>>> >>>> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see >>>> https://stat.ethz.ch/mailman/listinfo/r-help >>>> PLEASE do read the posting guide >>>> http://www.R-project.org/posting-guide.html >>>> and provide commented, minimal, self-contained, reproducible code. >>> >>> >>> >> >> [[alternative HTML version deleted]] >> >> -- >> >> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see >> https://stat.ethz.ch/mailman/listinfo/r-help >> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html >> and provide commented, minimal, self-contained, reproducible code. >> >> [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Anova
Hi all, I apologize for what might be a silly question. I am interested in doing a one way anova. This is not too hard in and of itself, either with anova, aov or oneway.test . However, I need to 1) get pvalues, 2) do a posthoc analysis with Tukey HSD, 3) and have (sometimes) an unbalanced design. I just can't seem to put all the pieces together. Any suggestions? Thanks in advance, Dan. -- Daniel C. Jupiter, Ph.D. Postdoctoral Research Associate Department of Systems Biology and Translational Medicine College of Medicine Texas A&M Health Science Center 702 SW H.K. Dodgen Loop Temple, TX 76504 979.997.2106 | Fax 254.742.7145 [EMAIL PROTECTED] | www.tamhsc.edu [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.