[R] Available in S-plus, also in R1.8.1?

Hoeven, Maarten van der Maarten.van.der.Hoeven at knmi.nl
Tue Feb 10 10:28:46 CET 2004


Agree, if a plot needs to be explained, something is not very well
thought of. However, there are good rationals to do it this way.
Moreover, I'm using R to replace SPSS-functionality (and imaging by
pvwave) within a project, and I want to be close as possible to the
image output of the preceeding project. Hence, this question.

The assumption is indeed an equidistant x-axis. This is true in my case.

What the stairstep-plot in R does (type="s" or type="S"), is to draw a
horizontal line between two points on the x-axis. For example,

x1 = 1980
x2 = 1981
x3 = 1982
y1 = 10
y2 = 12
y3 = 14

it draws a horizontal line between 1980 and 1981, at y-level 10 (or 12,
depening on type="s" or type="S").

What I'm looking for, and this can be achieved in S+ by the mentioned
connect type, is that the horizontal line *NOT* starts at exactly the
x-values, but half between. See the attached example, where there is
only one y-value of 1, at x=1995. You see the plot been drawn halfway
1995 (half before 1995, and half after 1995). This is what I'm look ing
for. When using type="s" and type="S" in the plot-function, this would
result in a polot that starts exactly at 1995, or ends exactly at 1995.
I want to have it in between.

Thanks,

Maarten


> -----Original Message-----
> From: Uwe Ligges [mailto:ligges at statistik.uni-dortmund.de]
> Sent: Tuesday, February 10, 2004 10:11 AM
> To: Hoeven, Maarten van der
> Cc: r-help at stat.math.ethz.ch
> Subject: Re: [R] Available in S-plus, also in R1.8.1?
> 
> 
> Hoeven, Maarten van der wrote:
> 
> > Hi,
> > 
> > I've send this one to the list last Thursday, no reaction yet. It's
> > about the Connect Type in S+.
> 
> In order to get an answer, you might want to be more specific what
> "Connect type: half horiz first" really does in S-PLUS. I don't think 
> something like that is available within an existing R 
> function (I might 
> be wrong here), but it can easily be coded (e.g. along the 
> lines of code 
> in package "stepfun"), given there is an *explicit 
> definition* (and the 
> cited URL is not very helpful here).
> My question is: How do you define the "middle of a step", in 
> particular 
> if the interesting x values of your step-function are not equidistant?
> 
> And another question: Why do you want to create a plot that 
> needs to be 
> explained? Other plots are much more intuitive (at least for me).
> 
> Uwe Ligges
> 
> 
> 
> > ===
> > 
> > Hello all,
> > 
> > I'm looking for the R-equivalent of the S-option "Connect type: half
> > horiz first". Link:
> > 
> http://miner.stern.nyu.edu/Splus/help/guihelp/__hhelp/connect_type.htm
> > 
> > I'm plotting with type="s" or type="S"; this is giving me a 
> stairstep
> > starting, or ending with the value on the x-axis (as 
> documented). But, I
> > want the x-value in the middle of the step, like "half 
> horiz first" in
> > S-plus does.
> > 
> > Is this possible in R?
> > 
> > 
> > Thanks,
> > Maarten
> > --------------------------------------------------------------
> > Zie ook/see also: http://www.knmi.nl/maildisclaimer.html
> > 
> > ______________________________________________
> > R-help at stat.math.ethz.ch mailing list
> > https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide! 
> http://www.R-project.org/posting-guide.html
> 
>
--------------------------------------------------------------
Zie ook/see also: http://www.knmi.nl/maildisclaimer.html 


More information about the R-help mailing list