John Maindonald | 28 Nov 08:34 2015

Re: Choice of graphics package

> "To do that effectively with lattice graphics you have to learn how to write panel functions"

There is an alternative mechanism that is usually easier.

The latticeExtra layering functions, due to Felix Andrews, overlay (or underlay) 
onto an existing trellis object.  The relevant functions are layer(), layer_(), 
glayer() (where there are groups), glayer_(), and as.layer().  The as.layer() 
function turns a trellis object into a layer that can then be ‘added' onto another
object.  The drawLayer() function provides a more interactive mechanism for 
achieving the same end.   These functions ought to be more widely known and
better advertised.  They are often easier to work with than panel functions.

My brief overview of these abilities can be found at:

Click on 'Layering in lattice’.

John Maindonald             email: john.maindonald <at>

> On 28/11/2015, at 00:00, Drew Tyre <atyre2 <at>> wrote:
> Message: 3
> Date: Thu, 26 Nov 2015 16:33:40 +0000
> From: Drew Tyre <atyre2 <at>>
> To: "Granaas, Michael" <Michael.Granaas <at>>, R-sig-teaching
> 	<r-sig-teaching <at>>
> Subject: Re: [R-sig-teaching] Choice of graphics package
(Continue reading)

Drew Tyre | 26 Nov 17:33 2015

Re: Choice of graphics package

I use R to teach graduate students in the life sciences (mostly ecology but branching out). So far I show
students both lattice and base  graphics. I like lattice graphics for exploration because of the ease of
faceting plots. I use base graphics for "production plots" because I find it easier to tell people how to
add things to a base plot (multiple lines etc). To do that effectively with lattice graphics you have to
learn how to write panel functions, and that can be a mind bending experience (it was/is for me). 

I have not developed the facility with ggplot that I have with base graphics, so I can't comment on it. I think
if one comes to truly understand the ggplot model it will be better/faster/easier than either base or
lattice graphics, but it's a new model. I don't know which will be easier to teach to students hitting it
"cold". I'd be interested in hearing from people that have tried teaching ggplot to students with no prior

Drew Tyre

School of Natural Resources
University of Nebraska-Lincoln
416 Hardin Hall, East Campus
3310 Holdrege Street
Lincoln, NE 68583-0974

phone: +1 402 472 4054
fax: +1 402 472 2946
email: atyre2 <at>

From: R-sig-teaching <r-sig-teaching-bounces <at>> on behalf of Granaas, Michael <Michael.Granaas <at>>
(Continue reading) | 26 Nov 00:28 2015

Re: purpose of the list

Forwarded message:
> From: Ista Zahn <istazahn <at>>
> To: Steven Stoline <sstoline <at>>
> On Nov 25, 2015 5:48 PM, "Steven Stoline" <sstoline <at>> 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.
> Sure, but your question was about basic extraction, not about teaching. As
> Hadley suggested R-help is more appropriate for questions like this.
> Best,
> Ista

The official blurb is open to interpretation but I agree with Ista.

"Special Interest Group (SIG) on teaching statistics with R. The
primary purpose of the group is to provide a forum where instructors
using R in their statistics courses can share ideas, teaching
materials, and experiences. One particular focus of the SIG is to
provide helpful support to instructors new to R who are teaching
introductory statistics courses populated with students with little
experience in statistics, statistical software, and command line

------->  First-time AP Stats. teacher?  Help is on the way! See
(Continue reading)

Steven Stoline | 25 Nov 18:47 2015

Re: Shading Area

Dear Robin:

it works

with many thanks

On Wed, Nov 25, 2015 at 12:44 PM, Donatello, Robin <rdonatello <at>>

> Use the polygon() function where x and y are the vertices of the area you
> want shaded.
> polygon(x=c(0,10,10,0),c(3,3,7,7),col=adjustcolor("gray", alpha.f=.5))
> polygon(x=c(5,7,7,5),c(0,0,10,10),col=adjustcolor("blue", alpha.f=.5))
> Robin Donatello, DrPH
> Assistant Professor
> Department of Mathematics and Statistics
> California State University Chico
> Holt 216
> 530-898-5767
> rdonatello <at>
> ________________________________________
> From: R-sig-teaching <r-sig-teaching-bounces <at>> on behalf of
> Steven Stoline <sstoline <at>>
> Sent: Wednesday, November 25, 2015 9:34 AM
(Continue reading)

Steven Stoline | 25 Nov 18:34 2015

Shading Area

Dear All:

How to shade the area between the lines  y = 3 and y = 7 (with gray color
(say),  and between the lines x = 5 and x = 7? with color light blue (say).

*here is the R code:*

plot(0:10, 0:10, type = "n", xaxt = "n", yaxs = "i", xaxs = "i", yaxt =
"n", xlab = "", ylab = "")

text(10.15, 0, "x", pos = 4, xpd = NA, cex = 1.25)

text(0, 11.00, "y", pos = 1.85, xpd = NA, cex = 1.25)

abline(h=3.0, col="red", lwd=1.5)
abline(h=7, col="red", lwd=1.5)

abline(v=5.0, col="gray", lwd=2.0)
abline(v=7, col="gray", lwd=2.0)

segments(0,5, 6,5, lty=2, lwd=2.0)
segments(6,0, 6,5, lty=2, lwd=2.0)

with thanks

Steven M. Stoline
1123 Forest Avenue
(Continue reading)

Steven Stoline | 25 Nov 13:13 2015

Excluding the zero from a sequence when created

Dear All:

How to exclude the zero from this sequence when created.


Because I want to do the following:


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

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

with many thanks

Steven M. Stoline
1123 Forest Avenue
Portland, ME 04112
sstoline <at>

	[[alternative HTML version deleted]]

Steven Stoline | 20 Oct 21:45 2015

count the number of argument of a function

Dear All:

I am wondering whether there is a way to read and assign the number of
arguments of a function inside this function.

### For example


m<- number of arguments


### e.g.


m<- number of arguments

### m =3 in this case


### e.g.


m<- number of arguments

### m =6 in this case
(Continue reading)

Steven Stoline | 23 Sep 16:02 2015

Read *.xlsx data file into R

Dear All:

I am having trouble reading an  *.xlsx data file into R.

I tried to install the packages XLSX and readx1, but still did not work.

Any helps will be appreciated.

with many thanks


Steven M. Stoline
1123 Forest Avenue
Portland, ME 04112
sstoline <at>

	[[alternative HTML version deleted]]

Daniel Pocock | 16 Sep 11:08 2015

self-taught routes to a degree with R?

Given the nature of mathematics and the fact that anybody can now
download, experiment and learn with software like R on a Linux desktop,
it seems more than plausible than ever that somebody could achieve the
level of knowledge required to pass undergraduate and probably some
masters level exams without attending classes.

There are plenty of schools now offering online courses yet many of them
appear to involve hefty tuition fees.  For people who have a history of
self-education, paying fees for classes they won't attend may feel wasteful.

A search also finds numerous pages of advice for people wanting to take
a self-taught route, e.g. but not all of
these lead to a formal degree.

My own view is that even without classes and without having a whole
bunch of money on the line, the goal of sitting an exam and getting a
degree provides a useful motivator for people who want to educate
themselves in this field.

Can anybody comment on any educators or schools who are willing to
engage with students who want to pursue that route?

Steven Stoline | 13 Jul 01:40 2015

Sample from Log-Normal Distribution

Dear All:

I need someone to clarify the value of the *meanlog* and *stlog* used in
the function *rlnorm* when you sample from log-normal distribution.

rlnorm(n, meanlog = 0, sdlog = 1)

*For example: *y<- rlnorm(25, meanlog = 5, sdlog = 1)

Is the value of the meanlog, *5*, the mean of the log-normal distribution.
Similarly, is the value of the *sdlog*, *1*, the standard deviation of the
log-normal distribution.

or 5 and 1 are the mean and standard deviation of the normal distribution
of x = log(y) ~N(mean =5, var = 1)

with many thanks



Steven M. Stoline
1123 Forest Avenue
Portland, ME 04112
sstoline <at>

	[[alternative HTML version deleted]]

Nguyen C. | 22 Jun 19:40 2015

Help on packages working with excell files

Dear friends,
I am trying to install and use xlsx package. After installeing xlsx and
rJava successfully, I type >library(xlsx) then R said :
Loading required package: rJava
Error : .onLoad failed in loadNamespace() for 'rJava', details:
  call: fun(libname, pkgname)
  error: No CurrentVersion entry in Software/JavaSoft registry! Try
re-installing Java and make sure R and Java have matching architectures.
Error: package ‘rJava’ could not be loaded"
I did the same for gdata package,  after installing succesfully and calling
library(gdata), I did:
> myDf<-read.xls("levuan2kq.xls",sheet=1,header=TRUE)
Error in findPerl(verbose = verbose) :
  perl executable not found. Use perl= argument to specify the correct path.
Error in file.exists(tfn) : invalid 'file' argument

Till now, I could not use any package to work with excel file.
Anyone can help me.

	[[alternative HTML version deleted]]

R-sig-teaching <at> mailing list