Skip to content

Some more help needed...

6 messages · v.demart@libero.it, Christian Hennig, Andy Bunn +3 more

#
As an absolute beginner, still reading  "Modern Applied Statistics with S" and exercising with its examples, I'm frequently stopped by what it looks to be R poor help system (or is it my gigantic ignorance?). I mean that using help many arguments of a command seems to be given for granted like for instance:
...............................
?lines
 lines(x, ...)

     ## Default S3 method:
     lines(x, y = NULL, type = "l", col = par("col"),
           lty = par("lty"), ...)

Arguments:

    x, y: coordinate vectors of points to join.

    type: character indicating the type of plotting; actually any of
          the 'type's as in 'plot'.

     col: color to use. This can be vector of length greater than one,
          but only the first value will be used.

     lty: line type to use.

     ...: Further graphical parameters (see 'par') may also be supplied
          as arguments, particularly, line type, 'lty' and line width,
          'lwd'.
................................

How could I quickly know during an R-session what values should be "col" set to have red, how could I set "lty" etc.?

Vittorio
#
Try help(par).

Christian
On Mon, 19 Jan 2004, v.demart at libero.it wrote:

            
***********************************************************************
Christian Hennig
Fachbereich Mathematik-SPST/ZMS, Universitaet Hamburg
hennig at math.uni-hamburg.de, http://www.math.uni-hamburg.de/home/hennig/
#######################################################################
ich empfehle www.boag-online.de
#
The R help is sublime - which can be lost on the beginner (it was on
me). See Chapter 12 Graphical procedures of the introduction to R manual
(http://cran.r-project.org/manuals.html). Then read the rest of the
manual before bed.

As for getting red and a solid line?
plot(1:100, log(1:100), type = "l", col = "red", lty = "solid")

Good luck, Andy
#
How about the following: 

 plot(1:11, col=1:11, cex=2, lwd=4)
 plot(1:4, col=c("red","green",'blue', 'orange'), cex=2, lwd=4)

      hope this helps.  spencer graves
v.demart at libero.it wrote:

            
#
"v.demart at libero.it" <v.demart at libero.it> writes:
Well, you might take a hint and look at ?par, in which this is in fact 
explained. The above text is not saying that very explicitly, I agree. 

However, it could be a good idea if we found a nice way of integrating
this sort of tabular material in the help system. The case that really
annoys me is that to get at the va?ues for 'pch', you need to run
example(points), which is both nonobvious and disruptive if you are in
the middle of constructing a complex plot command.
#
On Mon, 19-Jan-2004 at 06:36PM +0100, Peter Dalgaard wrote:
|> "v.demart at libero.it" <v.demart at libero.it> writes:
|> 
|> > As an absolute beginner, still reading "Modern Applied Statistics
|> > with S" and exercising with its examples, I'm frequently stopped
|> > by what it looks to be R poor help system (or is it my gigantic
|> > ignorance?). I mean that using help many arguments of a command
|> > seems to be given for granted like for instance:
|> > ...............................
|> > ?lines
|> >  lines(x, ...)
|> > 
|> >      ## Default S3 method:
|> >      lines(x, y = NULL, type = "l", col = par("col"),
|> >            lty = par("lty"), ...)
|> > 
|> > Arguments:
|> > 
|> >     x, y: coordinate vectors of points to join.
|> > 
|> >     type: character indicating the type of plotting; actually any of
|> >           the 'type's as in 'plot'.
|> > 
|> >      col: color to use. This can be vector of length greater than one,
|> >           but only the first value will be used.
|> > 
|> >      lty: line type to use.
|> > 
|> >      ...: Further graphical parameters (see 'par') may also be supplied
|> >           as arguments, particularly, line type, 'lty' and line width,
|> >           'lwd'.
|> > ................................
|> > 
|> > How could I quickly know during an R-session what values should be "col" set to have red, how could I set "lty" etc.?
|> 
|> Well, you might take a hint and look at ?par, in which this is in fact 
|> explained. The above text is not saying that very explicitly, I agree. 

... that hint being given a little further down the help for lines,
where it says:


See Also:

     'points', 'plot', and the underlying "primitive" 'plot.xy'.

     'par' for how to specify colors.


I can't think of a way that makes it easier to get to than that.


|> 
|> However, it could be a good idea if we found a nice way of
|> integrating this sort of tabular material in the help system. The
|> case that really annoys me is that to get at the va?ues for 'pch',
|> you need to run example(points), which is both nonobvious and
|> disruptive if you are in the middle of constructing a complex plot
|> command.

Even in that case, it's not a big deal to run a separate R session in
another workspace (or even better, viewport in the pre-Gnome2 days)
where such ancillary tasks can run.  There are OS limitations, of
course.