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
Julian Wells | 23 Feb 12:56 2015

Re: R-sig-teaching Digest, Vol 74, Issue 7

One might not use tables to *teach* stat.s, but one may wish to provide exam candidates with them.


On 23 Feb 2015, at 11:00, r-sig-teaching-request <at> wrote:

> Send R-sig-teaching mailing list submissions to
> 	r-sig-teaching <at>
> To subscribe or unsubscribe via the World Wide Web, visit
> or, via email, send a message with subject or body 'help' to
> 	r-sig-teaching-request <at>
> You can reach the person managing the list at
> 	r-sig-teaching-owner <at>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of R-sig-teaching digest..."
> Today's Topics:
>   1. Re: Normal Distribution Table (Randall Pruim)
> ----------------------------------------------------------------------
> Message: 1
> Date: Mon, 23 Feb 2015 06:15:04 +0000
(Continue reading)

Steven Stoline | 21 Feb 11:37 2015

Normal Distribution Table

Dear All:

I am trying to use the below R code to create the standard normal
distribution table. But I need some helps on the output:

1- how I can insert one line-space between each two rows.

2- there is  one "<NA>" in the output, how to remove it from the output.

Simply copy-paste the below code into R.

Here is the Code:

columnz<-c(0.00, 0.01, 0.02, 0.03, 0.04, 0.05, 0.06, 0.07, 0.08, 0.09)






A<-matrix(NA, nrow = m+1 , ncol = n+1)

for (i in (1:m+1)) {

(Continue reading)

Christopher W. Ryan | 14 Feb 05:27 2015

long term follow up from R workshops with high school students

Some of you may recall, from a couple years back, a discussion of
teaching R to high school students. Thought the group might be
interested in some follow up.

I did two 5-hour workshops with a group of students in a longitudinal
science research class at Rondout Valley High School in the Hudson
Valley region of New York State.

Their teacher is retiring after many years of service, and she was kind
enough to drop me a line.  Edited to remove some personal info, here is
what she wrote:

HI Chris,

. . . I did want to tell you that three of my senior students (you came
to visit these students 2X) have continued to learn R up to an
intermediate level. Two of my juniors (out of six) are learning R on
their own up to an intermediate level. Two of these have research
projects that will involve R in the analysis. Two students did not use R
but are capable of using other statistical analysis programs. Of my
twelve Junior and senior students  five of them are much more capable
with statistical analysis and readily continue to pursue coding and
statistics. One of the Juniors is teaching other students R and other
coding and has formed a computer club. I am really amazed at this
success . . . .  This is an inspiration to me. Students are willing to
go into areas that are completely unknown and become mathematically
literate in coding and statistics . . . . So you are right Chris you can
tell your friends on the R list that high school students can learn R
and become adept at it.
(Continue reading)

Manel Amado Martí | 5 Feb 09:08 2015

Optimizing loop

I'm processing a table database. To do that, I put it in a dataframe, and then I do the data processing
(normalization of some fields). I'm used to program in C, and some R's facilities are not so natural to me,
please, excuse me if the question is for "dummies".
In the processing, I want to substitute some field's value depending on the previous content. For example,
if field starts with a digit instead of an alpha character, the entire field from the actual row, I'll
replace it with "SOLPD". I'm sure that would be another way (maybe through some apply function), but I
can't figure how to do.
The code that I'm using now, is:
for( i in 1:nrow(dataframe2)) {
                        sprintf("elimina NIF autnom: % i\n",i)

Thank you for your attention!

Manel Amado i Mart
Cap d'Assessoria de Comer Interior
amado <at><mailto:amado <at>>
Tel. 93 745 12 63  Fax 93 745 12 64   
[] <>
Av. Francesc Maci, 35  08206 Sabadell
Apt. corr. 119<>
(Continue reading)

Steven Stoline | 8 Jan 19:06 2015

Analyze Nested and Split-Plot Designs with R

Dear All:

example 14.1, Montgomery, chapter 14. *Supplier* is a *fixed factor*,
*Batches* is a *random factor* nested within the fixed factor Supplier.

How to analyze these data in R in two ways:

1- Nested Design

fit <- aov(purity~Supplier/Batch)

it did not give me the expected output.

2- as a factorial (suppliers Fixed, Batches Random)

fit.out <- aov(Purity~Supplier*Batch, data=have)

it did not give me the expected output.

Here is the data set:

> data
  Supplier Batch  Purity
1     1  1
1     1 -1
1     1  0
1     2 -2
1     2 -3
1     2 -4
(Continue reading)

Nguyen C. | 5 Jan 16:48 2015

Could not load mosaic package

Dear all,
I have installed the latest version of R (64) and mosaic  package
sucessfully in my laptop (windown 7).
But when I try to load mosaic with comand >library(mosaic), I got the
following message:
Loading required package: car
Loading required package: dplyr
Error in get(".packageName", where) :
  cannot open file 'C:/Users/Nguyen
Tu/Documents/R/win-library/3.1/DBI/R/DBI.rdb': No such file or directory
Error: package ‘dplyr’ could not be loaded
I look at the win-library as mentioned above, then the folder
'C:/Users/Nguyen Tu/Documents/R/win-library/3.1/DBI/' is empty.
I do not know what is wrong and how to correct the problem.

Please help me.
Thank you in advance.

	[[alternative HTML version deleted]]

R-sig-teaching <at> mailing list
Warford, Stan | 30 Dec 23:49 2014

Legend for curve fit plot

Hello all,

I provide a function for my students to do two curve fits with a single set of data:

# Performs two curve fits, quadratic and n lg n, with a plot of the data and the two curves
# First parameter: A data frame
# Second parameter: Name of the independent (x) variable
# Third parameter: Name of the dependent (y) variable
# Fourth parameter: The label for the x-axis
# Fifth parameter: The label for the y-axis
dp4dsFit <- function(dataFrame, indepVarName, depVarName, xLabel, yLabel) {
  dp4dsQuadraticFit <- lm(dataFrame[,depVarName] ~ poly(dataFrame[,indepVarName],2))
  write("Quadratic fit\r",file="")
  dp4dsNlogNFit <- lm(dataFrame[,depVarName] ~
dataFrame[,indepVarName]:log(dataFrame[,indepVarName]) + dataFrame[,indepVarName])
  write("n lg n fit\r",file="")
  ggplot() +
    geom_point(data = dataFrame, aes_string(x = indepVarName, y = depVarName), size = 3) +
    geom_smooth(data = dataFrame, aes_string(x = indepVarName, y = depVarName),
                method = "lm", se = FALSE, colour = "RED", formula = y ~ poly(x,2)) +
    geom_smooth(data = dataFrame, aes_string(x = indepVarName, y = depVarName),
                method = "lm", se = FALSE, colour = "BLUE", formula = y ~ x:log(x) + x) +
(Continue reading)

Steven Stoline | 29 Dec 00:35 2014

Problem with "attach"

Dear All:

I do have problem with attach. I believe that I am doing the data.frame
correctly. But it seems that I do have problem with the "attach" statement.

here is what I am doing:


### approach<-c(rep(1,8), rep(2,8), rep(3,8))



donations <- data.frame(approach=approach,contributions=contributions)


the code "*plot(approach~contributions)* " should yield the box-plots, but
it does not.

This what I got from R:

> attach(donations)
The following objects are masked _by_ .GlobalEnv:
(Continue reading)

Yahoo! | 22 Dec 14:26 2014

random effect model in R---- lmer

Dear All:

I am trying to run arandom effect model in R, but when I used "lmer" I got the followingerrors: Please see below.


batchlevel <-c(1,1,1,2,2,2,3,3,3,4,4,4,5,5,5)

batch <-as.character(batchlevel)

yield <-c(74,76,75,68,71,72,75,77,77,72,74,73,79,81,79)

dataaov <-data.frame(batch,yield)

raneff <-lmer(yield~1+(1|batch),data=dataaov)

Error in get(name,envir = asNamespace(pkg), inherits = FALSE) : 

  object'.setDummyField' not found

(Continue reading)