[R] cbind question, please

2015-04-23 Thread Erin Hodgess
Hello!

I have a cbind type question, please:  Suppose I have the following:

dog <- 1:3
cat <- 2:4
tree <- 5:7

and a character vector
big.char <- c("dog","cat","tree")

I want to end up with a matrix that is a "cbind" of dog, cat, and tree.
This is a toy example.  There will be a bunch of variables.

I experimented with "do.call", but all I got was
1
2
3

Any suggestions would be much appreciated.  I still think that do.call
might be the key, but I'm not sure.

R Version 3-1.3, Windows 7.

Thanks,
Erin


-- 
Erin Hodgess
Associate Professor
Department of Mathematical and Statistics
University of Houston - Downtown
mailto: erinm.hodg...@gmail.com

[[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] reshape data frame when one column has unequal number of entries

2015-04-23 Thread Dimitri Liakhovitski
Thank you very much, everybody!

On Thu, Apr 23, 2015 at 10:38 AM, Duncan Mackay  wrote:
> Hi Dimitri
>
> here is a quick crude way (needs some polishing)
>
> data.frame(a = rep(x$a,sapply(sapply(x$b, strsplit, ", "), length)), b=
> unlist(sapply(x$b, strsplit, ", ")))
>
> Duncan
>
> Duncan Mackay
> Department of Agronomy and Soil Science
> University of New England
> Armidale NSW 2351
> Email: home: mac...@northnet.com.au
>
> -Original Message-
> From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Dimitri
> Liakhovitski
> Sent: Thursday, 23 April 2015 23:15
> To: r-help
> Subject: [R] reshape data frame when one column has unequal number of
> entries
>
> Hello!
>
> I have my data frame x with 2 character columns:
>
> x <- data.frame(a = numeric(), b = I(list()))
> x[1:3,"a"] = 1:3
> x[[1, "b"]] <- "a, b, c"
> x[[2, "b"]] <- "d, e"
> x[[3, "b"]] <- "f"
> x$a = as.character(x$a)
> x$b = as.character(x$b)
> x
> str(x)
>
> I need to produce this data frame:
>
> 1  a
> 1  b
> 1  c
> 2  d
> 2  e
> 3  f
>
> Is it possible without looping?
> Thank you!
>
>
> --
> Dimitri Liakhovitski
>
> __
> 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.
>



-- 
Dimitri Liakhovitski

__
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] Predictions on training set shorter than training set

2015-04-23 Thread William Dunlap
Are there missing values in your data?  If so, try adding
the argument
   na.action = na.exclude
to your original call to glm or lm.  It is like the default
na.omit except that it records which rows were omitted
(because they contained missing values) and fills in
the corresponding entries in the predictions, residuals, etc.
with NA's.

You can also set
   options(na.action = "na.exclude")
to make it the default na.action in lm() and similar functions.




Bill Dunlap
TIBCO Software
wdunlap tibco.com

On Thu, Apr 23, 2015 at 10:23 AM, Mark Drummond 
wrote:

> Hi all,
>
> Given a simple logistic regression on a training data set using glm,
> the number of predicted values is less than the number of observations
> in the training set:
>
> > fit.train.pred <- predict(fit, type = "response")
> > nrow(train)
> [1] 62660
> > length(fit.train.pred)
> [1] 58152
> >
>
> As a relative newcomer, I've run lots of simple glm, CART etc. models
> but this is the first time I have seen this happen.
>
> Is this a common issue and is there a fix? An option to predict() perhaps?
>
> --
> Cheers, Mark
>
> Mark Drummond
> m...@markdrummond.ca
>
> When I get sad, I stop being sad and be Awesome instead. TRUE STORY.
>
> __
> 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] Need content_transformer() called by tm_map() to change non-letters to spaces

2015-04-23 Thread Mike
Hello,
In the following code, any characters matching  "/|@| \\|") will be changed to 
a space. 
> library(tm)
> toSpace <- content_transformer(function(x, pattern) gsub(pattern, " ", x))
> docs <- tm_map(docs, toSpace, "/|@| \\|")

What code would transform all non-letters to a space?  (What goes where the 
x's are.)It is very difficult to put all non-letters in a string...  So I'm 
doing the opposite of the above.
> toSpace_2 <- content_transformer(function xxx))
> docs <- tm_map(docs, toSpace_2, "abcdefghijklmnopqrstuvwxyz")

This needs to be done by a content_transformer() function to maintain the 
integrity of docs.

Thanks
 
[[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] Predictions on training set shorter than training set

2015-04-23 Thread Mark Drummond
Hi all,

Given a simple logistic regression on a training data set using glm,
the number of predicted values is less than the number of observations
in the training set:

> fit.train.pred <- predict(fit, type = "response")
> nrow(train)
[1] 62660
> length(fit.train.pred)
[1] 58152
>

As a relative newcomer, I've run lots of simple glm, CART etc. models
but this is the first time I have seen this happen.

Is this a common issue and is there a fix? An option to predict() perhaps?

-- 
Cheers, Mark

Mark Drummond
m...@markdrummond.ca

When I get sad, I stop being sad and be Awesome instead. TRUE STORY.

__
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] Run Rscript and ignore errors?

2015-04-23 Thread Nick Matzke
Hi R-help,

I've looked at google, the Rscript documentation and the Rscript --help
output and haven't found much on this.  So, here's my question:

I have a rather long script that runs on various input datasets.  It is
quite convenient to run the script from the Terminal command line with
"Rscript scriptname.R"

However, some datasets will cause errors. These are non-essential errors --
just some datasets don't have certain columns so certain parts of the
overall analysis don't produce figures etc.  Yes, I could go through the
whole script and insert try() statements, etc.  But I'm lazy.

So, is there a way to run Rscript or something similar, and just have it
ignore all errors (i.e., keep running through the script)?  I.e., just like
what happens if you just copy-paste the whole script into the R window --
errors happen and are noted but the rest of the script keeps running.

Thanks very much for any help!!

Cheers!
Nick

[[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] GLM course in Palm Cove

2015-04-23 Thread Highland Statistics Ltd

Apologies for cross-posting


We would like to announce the following statistics course in Palm Cove, 
Australia.


Course1:  GLM with R (Bayesian and frequentist)
Location: Palm Cove, Australia
Date:   11-14 August 2015
Price:   475 GBP
Course website: http://www.highstat.com/statscourse.htm
Course flyer: 
http://www.highstat.com/Courses/Flyers/Flyer2015_08PalmCoveI.pdf



Keywords:
Bayesian statistics, MCMC and JAGS. Overdispersion and solutions. 
Poisson, negative binomial, Bernoulli, binomial,
beta, gamma, inverse Gaussian, lognormal, and binomial distributions. 
GLMs for count data and continuous data. Underdispersion. Truncated 
data. Power analysis.



Kind regards,

Alain Zuur

--
Dr. Alain F. Zuur

First author of:
1. Beginner's Guide to GAMM with R (2014).
2. Beginner's Guide to GLM and GLMM with R (2013).
3. Beginner's Guide to GAM with R (2012).
4. Zero Inflated Models and GLMM with R (2012).
5. A Beginner's Guide to R (2009).
6. Mixed effects models and extensions in ecology with R (2009).
7. Analysing Ecological Data (2007).

Highland Statistics Ltd.
9 St Clair Wynd
UK - AB41 6DZ Newburgh
Tel:   0044 1358 788177
Email: highs...@highstat.com
URL:   www.highstat.com

__
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] Power calculation

2015-04-23 Thread Keniajin Wambui
I am are currently evaluating risk factors associated with a virus A ,
incidence among patients with a follow-up sample of 312. Overall, the
virus incidence rate is estimated at 4.7 per 100 pyr, 95% CI
(3.0-7.4), with a total follow-up time of 383.9 person years and 18
incidence cases.

How can I do a power calculation based on assumptions of the virus
acquisition in patients who have virus B?
For a rate that is twice as high, four times as high, and even eight
times higher.


Virus B
Yes- 203 No-109

I have tried using which gives a very suscpicious power?

v <- qnorm(0.975)
mu <- 0.047
muEst <- 0.094 #for a rate twice as high
n <- 312

#top
left <-  (n*((muEst-mu)^2))/mu
left <- sqrt(left)
ucalc<-left -v
ucalc
pnorm(ucalc)

The formula used is at Essential Medical Statistics Book by Betty R
Kirkwood et al pg 420 formula 2.

__
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] run Rscript and ignore errors?

2015-04-23 Thread Nick Matzke
Hi R-help,

I've looked at google, the Rscript documentation and the Rscript --help
output and haven't found much on this.  So, here's my question:

I have a rather long script that runs on various input datasets.  It is
quite convenient to run the script from the Terminal command line with
"Rscript scriptname.R"

However, some datasets will cause errors. These are non-essential errors --
just some datasets don't have certain columns so certain parts of the
overall analysis don't produce figures etc.  Yes, I could go through the
whole script and insert try() statements, etc.  But I'm lazy.

So, is there a way to run Rscript or something similar, and just have it
ignore all errors (i.e., keep running through the script)?  I.e., just like
what happens if you just copy-paste the whole script into the R window --
errors happen and are noted but the rest of the script keeps running.

Thanks very much for any help!!

Cheers!
Nick

[[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] Error in solve.default(-val)

2015-04-23 Thread Michael Dewey

Andrés
Si prefieres escribir en español
https://stat.ethz.ch/mailman/listinfo/r-help-es
seria mejor

(That is a link to the Spanish language version of R-help)

On 23/04/2015 05:24, Andrés M wrote:

Buenas noches,
comedidamente me dirijo a ustedes para hacerles una consulta respecto a un
error que me ha salido al ejecutar R. Soy estudiante de Ingeniería y estoy
basando mi tesis en un estudio estadístico usando R Studio.
Estoy trabajando una base de datos con 12 variables y 1433 datos en cada
una de ellas. Al generar un modelo con la siguiente instrucción :


m2.C1F<-lme(C1F ~ 1, data = facultades, random = ~1|Programa/Facultad,

method = "ML")


donde m2.C1F hace referencia al nombre del modelo, C1F a la variable y
facultades, al data frame. El error que me sale es el siguiente:

Error in solve.default(-val) :
   system is computationally singular: reciprocal condition number =
5.50424e-20


No se a que se debe y me seria muy útil una sugerencia, opinión o ayuda que
me puedan brindar.

Muchas Gracias,

Andrés M.

[[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.



--
Michael
http://www.dewey.myzen.co.uk/home.html

__
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] R_Calculating Thiessen weights for an area with irregular boundary

2015-04-23 Thread Manoranjan Muthusamy
It certainly is! Thank you.

Cheers,
Mano

On Thu, Apr 23, 2015 at 12:02 AM, Rolf Turner 
wrote:

> On 22/04/15 22:43, Manoranjan Muthusamy wrote:
>
> 
>
>  4. 
>>  How can I show the Dirichlet tile names (i.e. 1,2,3,,8) in the
>> plot?
>>
>
> There's no built-in way at the moment as far as I can tell.
>
> One way to get the tiles to be labelled/numbered in the plot would be:
>
> plot(dX)
> text(X,labels=1:npoints(X))
>
> Slightly sexier:
>
> cents <- as.data.frame(t(sapply(tiles(dX),centroid.owin)))
> plot(dX)
> text(cents,labels=1:nrow(cents))
>
> Is this satisfactory?
>
> cheers,
>
> Rolf Turner
>
>
> --
> Rolf Turner
> Technical Editor ANZJS
> Department of Statistics
> University of Auckland
> Phone: +64-9-373-7599 ext. 88276
> Home phone: +64-9-480-4619
>

[[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] Why is findAssocs() not working?

2015-04-23 Thread Mike
findAssocs() is not working, as is seen below. "Lucid" and "dreaming" occur 
together quite often in the book. 

The corpus is a single document, the text version of a book.  Does this 
function require at least two documents?  If so, if I split the book in half 
will I get the correlations regarding the book as a whole, or in regards to how 
the two halves compare to each other?
> docs <- tm_map(docs, stemDocument)
> dtm <- DocumentTermMatrix(docs)
> freq <- colSums(as.matrix(dtm))
> ord <- order(freq)
> freq[tail(ord)]
one experi   will   can lucid dream
287   312   363   452   1018   2413
> freq[head(ord)]
abbey abdomin   abdu abraham absent   abus
1   1   1   1   1   1
> findAssocs(dtm, "dream", corlimit=0.6)
$dream
numeric(0)
> findAssocs(dtm, "dream", corlimit=0.1)
$dream
numeric(0)
> findAssocs(dtm, "lucid", corlimit=0.01)
$lucid
numeric(0)
> findAssocs(dtm, "lucid", corlimit=0.6)
$lucid
numeric(0)
> 
 

[[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] Possible bug in rlm

2015-04-23 Thread Francis Bursa
Dear all,

I believe I have found a bug in rlm in the MASS package. Specifically, the 
scale estimate can be wrong when there are no outliers. The following code 
snippet is an example:

dose <- c(0,1,2,0,1,2)
response <- c(0.659,1.633,3.621,1.803,3.093,4.424)
line <- c(1,1,1,2,2,2)
k2 <- seq(1.5,5,by=0.01)
repNA <- rep(NA,length(k2))
scale <- repNA
niter <- repNA
for (i in 1:length(k2)){
  rlm.fit <- rlm(response~dose+factor(line), psi=psi.huber,k=1.345,
 scale.est="proposal 2",k2=k2[i])
  scale[i] <- rlm.fit$s
  niter[i] <- length(rlm.fit$conv)
}
plot(k2,scale,type="b",col=niter)

For this dataset there are no outliers, so I would expect the scale to be a 
smooth function of k2 once k2 is reasonably large, certainly for k2 > 2. 
However, there is a funny jump in the scale estimate around k2 = 2.4, just at 
the point where the number of iterations to convergence falls from 3 to 1.

Looking at the source code, it appears that on each iteration, the scale is 
updated, then the parameters, and then a check for convergence is carried out 
just for the parameters, not the scale. So I would guess that in the range 
around k2=2.5 convergence is being reached when in fact the scale estimate 
hasn't converged.

I am using MASS version 7.3-33 and R version 3.1.0 on Windows.

I am not sure how common this issue is but there does not seem to be anything 
special about my dataset so it could be quite generic. Am I right that this is 
a bug?

Many thanks,
Francis Bursa

-- 
Francis Bursa
Statistician

Quantics Consulting Ltd
28 Drumsheugh Gardens
Edinburgh
EH3 7RN
 
Telephone: +44 (0) 131 440 2781 ext 207
 
Quantics - complex data into clear results     
Quantics is an ISO 9001 registered company       
www.quantics.co.uk

Please note that the contents of this e-mail (including any attachments) are 
confidential and may be legally privileged. If you are not the intended 
recipient you may not read, copy, distribute or make any other use of this 
email or its contents. If received in error, please tell us immediately by 
telephone on +44 (0) 131 440 2781 quoting the name of the sender and the 
intended recipient, then delete it from your system. Thank you.

__
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] Predict in glmnet for Cox family

2015-04-23 Thread jitvis
Will I be able to do a prediction similar to above with random forest and
compare both the predict survival time result from AFT model and the
Survival Random forest model ?

Sincerely,



--
View this message in context: 
http://r.789695.n4.nabble.com/Predict-in-glmnet-for-cox-family-tp4706070p4706320.html
Sent from the R help mailing list archive at Nabble.com.

__
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] Two Factorial Experiment with a Single Control Group

2015-04-23 Thread Darcy Trimpe
Thank you for the correction and the code. I had just discovered the repeated 
measure error myself yesterday :-). I had not thought of using a manova. This 
may work better than what I was going to do. Thanks again. 
- Original Message -

> From: "c06n [via R]" 
> To: "Darcy Trimpe" 
> Sent: Thursday, April 23, 2015 2:47:35 AM
> Subject: Re: Two Factorial Experiment with a Single Control Group

> Hi,

> do you mean you didn't take any measurements before treatment, only
> after the fact? If so you used an inappropriate design.

> It should have been a repeated measures design (
> https://en.wikipedia.org/wiki/Repeated_measures_design ) and looked
> like this:

> no treatment | acute | 3 weeks
> day 1 measurement t1 | measurement t1 | measurements t1
> ...
> day 27 measurement t2 | measurement t2 | measurement t2

> Coming back to your question: Of course you can test the group
> differences from the measurements with a MANOVA (
> https://en.wikipedia.org/wiki/Multivariate_analysis_of_variance ,
> http://statmethods.net/stats/anova.html ). Treatment (acute, 3 week,
> no treatment) would be the 3-level-factor.

> Below the R code:

> # make data frame
> dataset <- data.frame(
> "treatment" = c("acute", "acute", "acute",
> "3weeks", "3weeks", "3weeks",
> "no", "no", "no"),
> "noTX" = c(7, 5, 4, 21, 28, 26, 3, 4, 7),
> "TX" = c(9, 8, 7, 23, 27, 29, 2, 5, 9),
> stringsAsFactors = TRUE
> )

> # plot
> # http://www.statmethods.net/advgraphs/ggplot2.html
> install.packages("ggplot2")
> require(ggplot2)
> p1 <- qplot(treatment, noTX, data = dataset, geom = c("boxplot",
> "jitter"),
> fill = treatment, main = "noTX", ylab = "Value")
> p2 <- qplot(treatment, TX, data = dataset, geom = c("boxplot",
> "jitter"),
> fill = treatment, main = "TX", ylab = "Value")
> p1; p2

> # MANOVA
> # http://statmethods.net/stats/anova.html
> #
> http://cran.r-project.org/web/packages/HSAUR/vignettes/Ch_analysis_of_variance.pdf
> fit <- manova(cbind(noTX, TX) ~ treatment, data = dataset)
> summary(fit)

> If you reply to this email, your message will be added to the
> discussion below:
> http://r.789695.n4.nabble.com/Two-Factorial-Experiment-with-a-Single-Control-Group-tp4706153p4706293.html
> To unsubscribe from Two Factorial Experiment with a Single Control
> Group, click here .
> NAML




--
View this message in context: 
http://r.789695.n4.nabble.com/Two-Factorial-Experiment-with-a-Single-Control-Group-tp4706153p4706299.html
Sent from the R help mailing list archive at Nabble.com.
[[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] install.packages problem

2015-04-23 Thread Sales RExcel
It seems that installed.packages has changed behavior in 3.2.0.
We have a local package repository containing only binaries of packages (for 
Windows).

Since 3.2.0, using install.packages for a package form such a repository does 
not work any more.
The solution is to add the parameter type=“binary”.

The documentation mentions that

options(install.packages.check.source = "no”)

suppresses check for source version of the packages, but
using this and install.packages without type=“binary” produces an error because
seemingly there still is a check for the source version of the package.





[[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] R Freezes (Mac) using file.choose()

2015-04-23 Thread Erik Duhaime
Hi,

Did you ever get an answer about this?  It has been so so frustrating for 
me...

Thanks!


On Sunday, March 22, 2015 at 11:29:28 PM UTC-4, Vindoggy ! wrote:
>
> I'm using a mac with OSX Yosemite (10.10.2), running the latest version of 
> R (3.1.3). But I've been having this same issue since Mavericks came out, 
> using all of  the different versions of R that have come out since 
> Mavericks. 
>
> Often (approximately 15% of the time I would say), whenever I use a 
> function in R that pulls up a mac finder window, R will freeze and I am 
> left with the spinning beach ball until I force-quit R. This happens most 
> frequently when using "file.choose()" to open a file, but has happened to 
> me when changing the working directory through the "Misc" tab as well: 
>
> Misc-> Change Working Directory 
>
>
> This has happened on at least three different Mac machines of varying 
> ages, so I don't think this is a computer specific issue. And as much of 
> the scripts I have written use "file.choose()", this happens on a regular 
> basis. 
>
> Have other people run into this same issue? If so, is there a fix for it? 
> 
> [[alternative HTML version deleted]] 
>
> __ 
> r-h...@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-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] R lattice bwplot: Fill boxplots with specific color depending on factor level

2015-04-23 Thread Pablo Fleurquin
Thank you both.

I just wanted to point out that before assigning the order of colors in
vector col, one should check that it corresponds with how levels are
ordered in levels(mydata$Col3).

Best,
Pablo

2015-04-23 5:46 GMT+02:00 Richard M. Heiberger :

> Pablo,
>
> I would do it similarly.  I would also place the box and whiskers in
> the specified colors.
>
> ## install.packages(HH)  ## if you don't have it
> library(HH)
>
> bwplot(mydata$Col1~mydata$Col3 | mydata$Col2,data=mydata,
>groups = Col3,
>as.table = TRUE, # added to make it easier for factor levels
>layout = c(3,1), # looks nicer and easier to read
>panel = panel.bwplot.superpose,
>col = c(red,"darkorange",green),
>fill = c(red,"darkorange",green), fill.alpha=.6)
>
> I changed your amber to "darkorange" as the amber lines are almost
> invisible.
>
> Rich
>
> On Wed, Apr 22, 2015 at 9:26 PM, Duncan Mackay 
> wrote:
> > hi Pablo
> >
> > set.seed(1) # for reproducibility of data.frame
> > mydata <- rbind(data.frame(Col1 = rnorm(2*1000),Col2 =rep(c("A", "C"),
> > each=1000),Col3=factor(rep(c("YY","NN"), 1000))),data.frame(Col1 =
> > rnorm(1000),Col2 =rep(c("B")),Col3=factor(rep(c("YY","YN"), 500
> > mydata$Col2 <- factor(mydata$Col2)
> >
> > In future please do not put * at end makes it harder to copy
> >
> > red=rgb(249/255, 21/255, 47/255)
> > amber=rgb(255/255, 200/255,0/255) # amended to reveal a colour difference
> > green=rgb(39/255, 232/255, 51/255)
> >
> > # As  Deepayan Sarkar said bwplot is different to others
> >
> > bwplot(mydata$Col1~mydata$Col3 | mydata$Col2,data=mydata,
> >groups = Col3,
> >as.table = TRUE, # added to make it easier for factor levels
> >layout = c(3,1), # looks nicer and easier to read
> >panel = panel.superpose,
> >panel.groups = panel.bwplot,
> >fill = c(red,amber,green)
> > )
> >
> > Duncan
> >
> > Duncan Mackay
> > Department of Agronomy and Soil Science
> > University of New England
> > Armidale NSW 2351
> > Email: home: mac...@northnet.com.au
> >
> > -Original Message-
> > From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Pablo
> > Fleurquin
> > Sent: Thursday, 23 April 2015 02:03
> > To: r-help@r-project.org
> > Subject: [R] R lattice bwplot: Fill boxplots with specific color
> depending
> > on factor level
> >
> > Hi,
> >
> > I thoroughly looked for an answer to this problem with no luck.
> >
> > I have a dataframe with 3 factor levels: YY, NN, YN
> >
> > *>mydata <- rbind(data.frame(Col1 = rnorm(2*1000),Col2 =rep(c("A", "C"),
> > each=1000),Col3=factor(rep(c("YY","NN"), 1000))),data.frame(Col1 =
> > rnorm(1000),Col2 =rep(c("B")),Col3=factor(rep(c("YY","YN"), 500*
> >
> > Being Col3 of factor type with 3 levels: NN YY YN
> >
> > I want to make a boxplot using lattice bwplot and assign to each level a
> > specific color:
> >
> >
> >
> >
> >
> >
> > *# NN:>red=rgb(249/255, 21/255, 47/255)# YN:>amber=rgb(255/255, 126/255,
> > 0/255)# YY:>green=rgb(39/255, 232/255, 51/255)*
> >
> > Using bwplot function:
> >
> >
> > * >pl<-bwplot(mydata$Col1~mydata$Col3 |
> >
> mydata$Col2,data=mydata,ylab=expression(italic(R)),panel=function(...){panel
> > .bwplot(...,groups=mydata$Col3,
> > fill=c(red,amber,green))})*
> >
> > IF YOU REPRODUCE THE EXAMPLE YOU WILL SEE THAT THE COLORS ARE NOT RELATED
> > TO THE LEVELS IN MY DATAFRAME AS YY BOX IS NOT ALWAYS GREEN.
> >
> > IS THERE A WAY TO ASSIGN YY:green, NN:red, YN:amber?
> >
> > You can see the resulting figure in:
> >
> http://stackoverflow.com/questions/29802129/r-lattice-bwplot-fill-boxplots-w
> > ith-specific-color-depending-on-factor-level
> >
> > Thank you in advance!
> > Pablo
> >
> > [[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-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] Error in solve.default(-val)

2015-04-23 Thread Andrés M
Buenas noches,
comedidamente me dirijo a ustedes para hacerles una consulta respecto a un
error que me ha salido al ejecutar R. Soy estudiante de Ingeniería y estoy
basando mi tesis en un estudio estadístico usando R Studio.
Estoy trabajando una base de datos con 12 variables y 1433 datos en cada
una de ellas. Al generar un modelo con la siguiente instrucción :

> m2.C1F<-lme(C1F ~ 1, data = facultades, random = ~1|Programa/Facultad,
method = "ML")


donde m2.C1F hace referencia al nombre del modelo, C1F a la variable y
facultades, al data frame. El error que me sale es el siguiente:

Error in solve.default(-val) :
  system is computationally singular: reciprocal condition number =
5.50424e-20


No se a que se debe y me seria muy útil una sugerencia, opinión o ayuda que
me puedan brindar.

Muchas Gracias,

Andrés M.

[[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] reshape data frame when one column has unequal number of entries

2015-04-23 Thread PIKAL Petr
Hi

I am not sure if this is more efficient than some loop

I just gave your data another column names.
> names(x)<-c("one", "two")
> x
  one two
1   1 a, b, c
2   2d, e
3   3   f

> s<-(strsplit(x$two, ","))
> s
[[1]]
[1] "a"  " b" " c"

[[2]]
[1] "d"  " e"

[[3]]
[1] "f"

> first<-rep(x$one ,unlist(lapply(s, length)))

> data.frame(first, second=unlist(s))
  first second
1 1  a
2 1  b
3 1  c
4 2  d
5 2  e
6 3  f

Maybe you want to remove extra white space form your values. It is mentioned 
somewhere in help pages to regular expressions

Cheers
Petr


> -Original Message-
> From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Dimitri
> Liakhovitski
> Sent: Thursday, April 23, 2015 3:15 PM
> To: r-help
> Subject: [R] reshape data frame when one column has unequal number of
> entries
>
> Hello!
>
> I have my data frame x with 2 character columns:
>
> x <- data.frame(a = numeric(), b = I(list()))
> x[1:3,"a"] = 1:3
> x[[1, "b"]] <- "a, b, c"
> x[[2, "b"]] <- "d, e"
> x[[3, "b"]] <- "f"
> x$a = as.character(x$a)
> x$b = as.character(x$b)
> x
> str(x)
>
> I need to produce this data frame:
>
> 1  a
> 1  b
> 1  c
> 2  d
> 2  e
> 3  f
>
> Is it possible without looping?
> Thank you!
>
>
> --
> Dimitri Liakhovitski
>
> __
> 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.


Tento e-mail a jakékoliv k němu připojené dokumenty jsou důvěrné a jsou určeny 
pouze jeho adresátům.
Jestliže jste obdržel(a) tento e-mail omylem, informujte laskavě neprodleně 
jeho odesílatele. Obsah tohoto emailu i s přílohami a jeho kopie vymažte ze 
svého systému.
Nejste-li zamýšleným adresátem tohoto emailu, nejste oprávněni tento email 
jakkoliv užívat, rozšiřovat, kopírovat či zveřejňovat.
Odesílatel e-mailu neodpovídá za eventuální škodu způsobenou modifikacemi či 
zpožděním přenosu e-mailu.

V případě, že je tento e-mail součástí obchodního jednání:
- vyhrazuje si odesílatel právo ukončit kdykoliv jednání o uzavření smlouvy, a 
to z jakéhokoliv důvodu i bez uvedení důvodu.
- a obsahuje-li nabídku, je adresát oprávněn nabídku bezodkladně přijmout; 
Odesílatel tohoto e-mailu (nabídky) vylučuje přijetí nabídky ze strany příjemce 
s dodatkem či odchylkou.
- trvá odesílatel na tom, že příslušná smlouva je uzavřena teprve výslovným 
dosažením shody na všech jejích náležitostech.
- odesílatel tohoto emailu informuje, že není oprávněn uzavírat za společnost 
žádné smlouvy s výjimkou případů, kdy k tomu byl písemně zmocněn nebo písemně 
pověřen a takové pověření nebo plná moc byly adresátovi tohoto emailu případně 
osobě, kterou adresát zastupuje, předloženy nebo jejich existence je adresátovi 
či osobě jím zastoupené známá.

This e-mail and any documents attached to it may be confidential and are 
intended only for its intended recipients.
If you received this e-mail by mistake, please immediately inform its sender. 
Delete the contents of this e-mail with all attachments and its copies from 
your system.
If you are not the intended recipient of this e-mail, you are not authorized to 
use, disseminate, copy or disclose this e-mail in any manner.
The sender of this e-mail shall not be liable for any possible damage caused by 
modifications of the e-mail or by delay with transfer of the email.

In case that this e-mail forms part of business dealings:
- the sender reserves the right to end negotiations about entering into a 
contract in any time, for any reason, and without stating any reasoning.
- if the e-mail contains an offer, the recipient is entitled to immediately 
accept such offer; The sender of this e-mail (offer) excludes any acceptance of 
the offer on the part of the recipient containing any amendment or variation.
- the sender insists on that the respective contract is concluded only upon an 
express mutual agreement on all its aspects.
- the sender of this e-mail informs that he/she is not authorized to enter into 
any contracts on behalf of the company except for cases in which he/she is 
expressly authorized to do so in writing, and such authorization or power of 
attorney is submitted to the recipient or the person represented by the 
recipient, or the existence of such authorization is known to the recipient of 
the person represented by the recipient.
__
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] reshape data frame when one column has unequal number of entries

2015-04-23 Thread Duncan Mackay
Hi Dimitri

here is a quick crude way (needs some polishing)

data.frame(a = rep(x$a,sapply(sapply(x$b, strsplit, ", "), length)), b=
unlist(sapply(x$b, strsplit, ", ")))

Duncan

Duncan Mackay
Department of Agronomy and Soil Science
University of New England
Armidale NSW 2351
Email: home: mac...@northnet.com.au

-Original Message-
From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Dimitri
Liakhovitski
Sent: Thursday, 23 April 2015 23:15
To: r-help
Subject: [R] reshape data frame when one column has unequal number of
entries

Hello!

I have my data frame x with 2 character columns:

x <- data.frame(a = numeric(), b = I(list()))
x[1:3,"a"] = 1:3
x[[1, "b"]] <- "a, b, c"
x[[2, "b"]] <- "d, e"
x[[3, "b"]] <- "f"
x$a = as.character(x$a)
x$b = as.character(x$b)
x
str(x)

I need to produce this data frame:

1  a
1  b
1  c
2  d
2  e
3  f

Is it possible without looping?
Thank you!


-- 
Dimitri Liakhovitski

__
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-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] high density plots using lattice dotplot()

2015-04-23 Thread Duncan Mackay
Hi Luigi

Michael answered your question about printing 

lattice and ggplot require their graphics to be in print()

If you have problems in printing you may have to use 

trellis.device(device = pdf,  # or what ever the actual device is
file = ,
)
? trellis.device for info
I occasionally have to use it sometimes instead of pdf etc

Duncan

-Original Message-
From: Luigi Marongiu [mailto:marongiu.lu...@gmail.com] 
Sent: Thursday, 23 April 2015 22:56
To: Duncan Mackay
Subject: Re: [R] high density plots using lattice dotplot()

Dear Duncan,
many thanks for the precious help! I have rearranged what you sent me
with a bit of stuff I wrote already for another project and the
results seems to work fine.
Best regards,
Luigi

>>> example
DF <-
  data.frame(Y = rnorm(17280),
 X = rnorm(1:45),
 Y2 = rnorm(17280)+2,
 Z  = 1:384)
head(df,10)
xyplot(Y ~ X | Z,
   data = DF,
   groups = Z,
   allow.multiple = TRUE,
   ylab= "Y VALUES",
   xlab="X VALUES",
   main="TITLE",
   scales = list(
 x = list(draw = FALSE),
 y = list(draw = FALSE),
 relation="same",
 alternating=TRUE),
   as.table = TRUE,
   layout = c(24,16),
   par.settings = list(
 strip.background=list(col="white"),
 axis.text = list(cex = 0.6),
 par.xlab.text = list(cex = 0.75),
 par.ylab.text = list(cex = 0.75),
 par.main.text = list(cex = 0.8),
 superpose.symbol = list(type = "l", cex = 1)
   ),
   strip= FALSE,
   type = "l",
   col = 3,
   panel = panel.superpose
)

On Thu, Apr 23, 2015 at 3:08 AM, Duncan Mackay  wrote:
> Hi Luigi
>
> Try
>
> set.seed(1)
>
> PLATE <-
> data.frame(Delta.Rn = rnorm(500),
>Cycle = rnorm(500),
>Delta2 = rnorm(500)+1,
>Well  = rep(1:50, each = 10))
> head(PLATE,10)
>
> xyplot(Delta.Rn+Delta2 ~ Cycle | Well,
>  data = subset(PLATE, Well %in% 1:49),
>  allow.multiple = TRUE,
>  ylab="Fluorescence (Delta Rn)",
>  xlab="Cycles",
>  main="TITLE",
>  scales = list(
>x = list(draw = FALSE),
>y = list(draw = FALSE),
>relation="same",
>alternating=TRUE),
>  as.table = TRUE,
>  layout = c(10,5),
>  par.settings = list(
>strip.background=list(col="white"),
># layout.heights = list(strip = 0.8),
>axis.text = list(cex = 0.6),
>par.xlab.text = list(cex = 0.75),
>par.ylab.text = list(cex = 0.75),
>par.main.text = list(cex = 0.8),
>superpose.symbol = list(pch = ".", cex = 2,
>col = c(2,4) )
>  ),
>  strip= FALSE,
>  type = "p",
>  key = list(text = list(label = c("Delta.Rn","Delta2")),
> points = list(cex = 0.6, pch = 16, col = c(2,4)),
> cex = 0.6,
> x = 0.9,
> y = 0.1),
>  panel = panel.superpose,
>  panel.groups = function(x,y,...){
>
>panel.xyplot(x,y,... )
>
># text argument can be a vector of values not
># necessarily the group name
>pnl = panel.number()  # needed as group.number if added is 
> now either 1 or 2
>
>grid.text(c(LETTERS,letters)[pnl],
>  y = 0.93, x = 0.5,
>  default.units = "npc",
>  just = c("left", "bottom"),
>  gp = gpar(fontsize = 7) )
>
>  }
>   )
>
> Remember to delete the group argument (I forgot to at first as the groups are 
> now Delta.Rn Delta2)
> You may have 1+ empty panels so put the legend there where ever it is just 
> amend the x and y or fine tune them
> you can have the pch = "." and increase cex but  it will become as square 
> with large cex
> Duncan
>
>
> -Original Message-
> From: Luigi Marongiu [mailto:marongiu.lu...@gmail.com]
> Sent: Thursday, 23 April 2015 10:05
> To: Duncan Mackay
> Subject: Re: [R] high density plots using lattice dotplot()
>
> Dear Duncan,
> sorry to come back so soon, but i wanted to ask you whether it would
> be  possible to plot two sets of lines within each box, let's say a
> main value A and a secondary value B. In normal plots I could use a
> plot() followed by points(); what would be the strategy here?
> Thank you again,
> best regards,
> Luigi
>
>
> On Wed, Apr 22, 2015 at 6:46 AM, Duncan Mackay  wrote:
>>
>> Hi Luigi
>>
>> I should have made up an example to make things easier when I replied today
>>
>> This should get you going
>>
>> set.seed(1)
>>
>> PLATE <-
>> data.frame(Delta.Rn = rnorm(500),
>>Cycle = rnorm(500),
>>Well  = rep(1:50, each = 10))
>> head(PLATE)
>>
>> xyplot(De

Re: [R] How to calculate vif of each term of model in R?

2015-04-23 Thread PIKAL Petr
Well. Your function results in error.

> f1<-function(model){
+ vfs<<-vif(model)
+ vfs
+ ex<<-subset(vfs,vfs>=10)
+ print(ex)
+ maxx<<-which.max(ex)
+ print(maxx)
+ mm<<-vector(mode = "numeric",length = 50)
+
+ mm<<-maxx
+ maxindex<<-which.max(ex)
+ print(maxindex)
+
+ }
> F1(model1)
Error: could not find function "F1"
>
> f1(model1)
Error in vcov(fit, regcoef.only = TRUE) : object 'model1' not found
>

Beside, why do you use global assignment.

<<-

within your function? I use R for more than 10 years and do not remember that I 
needed to use it.

You did not provide any data nor try to work on my suggestions. If you kept 
your mail copies to list you probably would get the answer more quickly.

You can use as.formula construction to programmatically select terms for update.

> fit

Call:
lm(formula = barviv ~ rutil + sio2 + teklat + fe, data = prov)

Coefficients:
(Intercept)rutil sio2   teklat   fe
   1230.1545.956   15.123   55.322 5571.923

> vif(fit)
   rutil sio2   teklat   fe
1.249975 1.702475 1.504633 1.094505
> which.max(vif(fit))
sio2
   2
> wmvif <- which.max(vif(fit))
> update(fit, as.formula(paste(". ~ . -",names(vif(fit)[wmvif]

Call:
lm(formula = barviv ~ rutil + teklat + fe, data = prov)

Coefficients:
(Intercept)rutil   teklat   fe
1220.25 6.0497.44  5802.31

Cheers
Petr

> -Original Message-
> From: Methekar, Pushpa (GE Transportation, Non-GE)
> [mailto:pushpa.methe...@ge.com]
> Sent: Friday, April 17, 2015 2:47 PM
> To: PIKAL Petr
> Subject: RE: How to calculate vif of each term of model in R?
>
> Hey ,
> .- names(vif(model1))[vmax])
> Is not working actually
> Instead
> Update(model1,.~.-x8) is working fine.
>
>
>
> For that any option would you tell me.
> As per your concern
> Update(model1,.~.-names(vif(model1))[vmax] means
>
> Update(model1,.~.-"x8")
> But it's not going to work.
>
> Look here is my program
>
> > require(rms)
> f1<-function(model){
> vfs<<-vif(model)
> vfs
> ex<<-subset(vfs,vfs>=10)
> print(ex)
> maxx<<-which.max(ex)
> print(maxx)
> mm<<-vector(mode = "numeric",length = 50)
>
> mm<<-maxx
> maxindex<<-which.max(ex)
> print(maxindex)
>
> }
> F1(model1)
>
>
>
> Output:
>f1(model1)
>x7x8x9
>  13.87063 220.96963 214.03413
> [1] 220.9696
> x8
>  2
>
>
> Now I have to do outside function explicitly
> model1<-update(model1,.~.-x8)
> then only I can remove my variable x8
>
> but I want to do in inside function so that automatically maximum
> element get eliminated .
>
>
> Thanks,
> Pushpa
>
>
>
> -Original Message-
> From: PIKAL Petr [mailto:petr.pi...@precheza.cz]
> Sent: Friday, April 17, 2015 5:25 PM
> To: Methekar, Pushpa (GE Transportation, Non-GE)
> Cc: r-help@r-project.org
> Subject: RE: How to calculate vif of each term of model in R?
>
> Hi
>
> > -Original Message-
> > From: Methekar, Pushpa (GE Transportation, Non-GE)
> > [mailto:pushpa.methe...@ge.com]
> > Sent: Friday, April 17, 2015 1:12 PM
> > To: PIKAL Petr
> > Subject: RE: How to calculate vif of each term of model in R?
> >
> > Hi Petr,
> > You got my problem ,the solution which u specified is little good but
> > with
> >
> >
> > >update(model1,.~. - names(vif(model1))[vmax])
> >
> >
> >
> > I won't be able to update my model .
> > Instead I have to write like
> >
> >
> > > update(model1,.~. - x8)
> >
>
> maybe something like
>
> fun = function(model1) {
>
> vmax <- which.max(vif(model1))
>
> while( vif(model1)[vmax]>=10) {
>
> model1 <- update(model1,.~. - names(vif(model1))[vmax])) vmax <-
> which.max(vif(model1))
>
> }
>
> return(model1)
>
> }
>
> I am not sure about cycle (i did not use while in R for a while).
>
> Without some data I cannot check syntax so it is up to you.
>
> Cheers
> Petr
>
>
> >
> > i.e my x which having highest vif value.
> > Each time for removing highest x .i  have to explicitly write ..-
> > x8) So is there any way to avoid this?
> >
> >
> >
> >
> > Thanks,
> > Pushpa
> >
> > -Original Message-
> > From: PIKAL Petr [mailto:petr.pi...@precheza.cz]
> > Sent: Friday, April 17, 2015 4:16 PM
> > To: Methekar, Pushpa (GE Transportation, Non-GE)
> > Subject: RE: How to calculate vif of each term of model in R?
> >
> > Comments to your first mail which are among lines and directly
> related
> > to your code.
> >
> > I specifically mentioned it
> >
> > > answers and comments in line
> >
> > If you have my first respond you can find them easier then now as
> they
> > are buried within your mail.
> >
> > Cheers
> > Petr
> >
> >
> > > -Original Message-
> > > From: Methekar, Pushpa (GE Transportation, Non-GE)
> > > [mailto:pushpa.methe...@ge.com]
> > > Sent: Friday, April 17, 2015 12:10 PM
> > > To: PIKAL Petr
> > > Subject: RE: How to calculate vif of each term of model in R?
> > >
> > > What comments are you talking about?
> > >
> > > -Original Message-
> > > From: PIKAL Petr [mailto:petr.pi...@preche

Re: [R] problem setting default timezone

2015-04-23 Thread Michael Dewey

In-line below

On 23/04/2015 14:01, Bos, Roger wrote:

Dear All,

I would like to learn the proper way to set the default time zone so I get the 
correct date for my files.  The code below is non-reproducible (sorry) because 
it is based on a file on my system, but I hope someone will be able to help me 
anyway.

I have a file that was last modified on 4/21/2015:


file.info("E:/snap/q/snap_q_q1_" %+% endPeriod %+% ".txt")$mtime

[1] "2015-04-21 20:26:33 EDT"

When I convert that to a date, I gives me 2015-04-22.  I read about timezones 
and saw that there are two possible places to set the default values: One as a 
system variable and one as an option.  To be safe I set both:


 Sys.setenv(TZ='America/New_York')
 Sys.getenv("TZ")

[1] "America/New_York"

 options(tz='America/New_York')
 getOption("tz")

[1] "America/New_York"

 as.Date(file.info("E:/snap/q/snap_q_q1_" %+% endPeriod %+% ".txt")$mtime)

[1] "2015-04-22"

But as you can see R still gives me the wrong date.  I can get the correct date 
as follows:


 as.Date(file.info("E:/snap/q/snap_q_q1_" %+% endPeriod %+% ".txt")$mtime, 
tz='America/New_York')

[1] "2015-04-21"

But my question is why is the as.Date function not using the timezone I have 
set?


Because it has a tz= parameter which sets its time zone. I think you 
need to write your own wrapper function to pick up your preferred timezone.




Thank you in advance,
Roger


***
This message and any attachments are for the named person's use only.
This message may contain confidential, proprietary or legally privileged
information. No right to confidential or privileged treatment
of this message is waived or lost by an error in transmission.
If you have received this message in error, please immediately
notify the sender by e-mail, delete the message, any attachments and all
copies from your system and destroy any hard copies. You must
not, directly or indirectly, use, disclose, distribute,
print or copy any part of this message or any attachments if you are not
the intended recipient.


__
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.



--
Michael
http://www.dewey.myzen.co.uk/home.html

__
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] problem setting default timezone

2015-04-23 Thread John McKown
On Thu, Apr 23, 2015 at 8:01 AM, Bos, Roger 
wrote:

> Dear All,
>
> I would like to learn the proper way to set the default time zone so I get
> the correct date for my files.  The code below is non-reproducible (sorry)
> because it is based on a file on my system, but I hope someone will be able
> to help me anyway.
>
> I have a file that was last modified on 4/21/2015:
>
> > file.info("E:/snap/q/snap_q_q1_" %+% endPeriod %+% ".txt")$mtime
> [1] "2015-04-21 20:26:33 EDT"
>
> When I convert that to a date, I gives me 2015-04-22.  I read about
> timezones and saw that there are two possible places to set the default
> values: One as a system variable and one as an option.  To be safe I set
> both:
>
> > Sys.setenv(TZ='America/New_York')
> > Sys.getenv("TZ")
> [1] "America/New_York"
> > options(tz='America/New_York')
> > getOption("tz")
> [1] "America/New_York"
> > as.Date(file.info("E:/snap/q/snap_q_q1_" %+% endPeriod %+%
> ".txt")$mtime)
> [1] "2015-04-22"
>
> But as you can see R still gives me the wrong date.  I can get the correct
> date as follows:
>
> > as.Date(file.info("E:/snap/q/snap_q_q1_" %+% endPeriod %+%
> ".txt")$mtime, tz='America/New_York')
> [1] "2015-04-21"
>
> But my question is why is the as.Date function not using the timezone I
> have set?
>
> Thank you in advance,
> Roger
>
>
​Doing a ?file.info told me that the mtime variable is a POSIXct value.
Doing a ?as.Date told me that when a POSIXct value is given to it, the time
zone defaults to GMT, _not_ to the local time. That is my interpretation of
the documentation.​



The ‘as.Date’ methods accept character strings, factors, logical
 ‘NA’ and objects of classes ‘"POSIXlt"’ and ‘"POSIXct"’.  (The
 last is converted to days by ignoring the time after midnight in
 the representation of the time in specified time zone, default
 UTC.)  Also objects of class ‘"date"’ (from package ‘date’) and
 ‘"dates"’ (from package ‘chron’).  Character strings are processed
 as far as necessary for the format specified: any trailing
 characters are ignored.


​What I would do is:

as.Date(file.info("..."),tz=getOption("tz"))​

-- 
If you sent twitter messages while exploring, are you on a textpedition?

He's about as useful as a wax frying pan.

10 to the 12th power microphones = 1 Megaphone

Maranatha! <><
John McKown

[[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] create function to plot high density data using lattice

2015-04-23 Thread Michael Dewey
I suspect Luigi that if you wrap the call to xyplot in print(  ) 
matters might be improved.


On 23/04/2015 13:50, Luigi Marongiu wrote:

Dear all,
with the most useful help of Duncan I updated a script to plot high
density data in the form of 384 squares containing tiny plots. The
function works and it is possible to create a pdf version of the
output. but when i try to make a function out of this script, the
resulting pdf file is empty.
Any tips?
Thank you and best regards,
Luigi


  >>> here is the example:


DF <-  data.frame(Y = rnorm(17280),
  X = rnorm(1:45),
  Y2 = rnorm(17280)+2,
  Z  = 1:384)
plot.layout <- function(DF) {

# this works from here...
pdf(
   file = "TITLE-amp outlook.pdf",
   width = 15,
   height = 11,
   onefile = TRUE,
   family = "Helvetica",
   paper = "a4r"
)
xyplot(Y ~ X | Z,
data = DF,
groups = Z,
allow.multiple = TRUE,
ylab= "Y VALUES",
xlab="X VALUES",
main="TITLE",
scales = list(
  x = list(draw = FALSE),
  y = list(draw = FALSE),
  relation="same",
  alternating=TRUE),
as.table = TRUE,
layout = c(24,16),
par.settings = list(
  strip.background=list(col="white"),
  axis.text = list(cex = 0.6),
  par.xlab.text = list(cex = 0.75),
  par.ylab.text = list(cex = 0.75),
  par.main.text = list(cex = 0.8),
  superpose.symbol = list(type = "l", cex = 1)
),
strip= FALSE,
type = "l",
col = 3,
panel = panel.superpose
)
dev.off()
#... till here

}
plot.layout(DF)

__
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.



--
Michael
http://www.dewey.myzen.co.uk/home.html

__
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] reshape data frame when one column has unequal number of entries

2015-04-23 Thread Dimitri Liakhovitski
Hello!

I have my data frame x with 2 character columns:

x <- data.frame(a = numeric(), b = I(list()))
x[1:3,"a"] = 1:3
x[[1, "b"]] <- "a, b, c"
x[[2, "b"]] <- "d, e"
x[[3, "b"]] <- "f"
x$a = as.character(x$a)
x$b = as.character(x$b)
x
str(x)

I need to produce this data frame:

1  a
1  b
1  c
2  d
2  e
3  f

Is it possible without looping?
Thank you!


-- 
Dimitri Liakhovitski

__
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] - Obtaining superscripts to affix to means that are not significantly different from each other with R

2015-04-23 Thread Joachim Audenaert
Is there also a version for non parametric tests like: 

pairwise.wilcox.test {stats} 



Met vriendelijke groeten - With kind regards,

Joachim Audenaert 
onderzoeker gewasbescherming - crop protection researcher

PCS | proefcentrum voor sierteelt - ornamental plant research

Schaessestraat 18, 9070 Destelbergen, België
T: +32 (0)9 353 94 71 | F: +32 (0)9 353 94 95
E: joachim.audena...@pcsierteelt.be | W: www.pcsierteelt.be 



From:   David L Carlson 
To: Joachim Audenaert , 
"r-help@r-project.org" 
Date:   23/04/2015 14:51
Subject:RE: [R] - Obtaining superscripts to affix to means that 
are not significantly different from each other with R



The function cld() in package multcomp generates compact letter displays, 
but does not format them as exponents of the group names.

-
David L Carlson
Department of Anthropology
Texas A&M University
College Station, TX 77840-4352

-Original Message-
From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Joachim 
Audenaert
Sent: Thursday, April 23, 2015 4:58 AM
To: r-help@r-project.org
Subject: [R] - Obtaining superscripts to affix to means that are not 
significantly different from each other with R

Hello all,

It is often time consuming to interpret p-values of multiple pairwise 
comparisons of groups and assign them a letter code for publication 
purposes. So I found this interesting link to a program that does this for 

you. 

http://www.jerrydallal.com/lhsp/similar.htm

I was wondering if something similar exists in R?


Met vriendelijke groeten - With kind regards,

Joachim Audenaert 
onderzoeker gewasbescherming - crop protection researcher

PCS | proefcentrum voor sierteelt - ornamental plant research

Schaessestraat 18, 9070 Destelbergen, Belgi�
T: +32 (0)9 353 94 71 | F: +32 (0)9 353 94 95
E: joachim.audena...@pcsierteelt.be | W: www.pcsierteelt.be 

Heb je je individuele begeleiding bemesting (CVBB) al aangevraagd? | Het 
PCS op LinkedIn
Disclaimer | Please consider the environment before printing. Think green, 

keep it on the screen!
 [[alternative HTML version deleted]]




Heb je je individuele begeleiding bemesting (CVBB) al aangevraagd? | Het 
PCS op LinkedIn
Disclaimer | Please consider the environment before printing. Think green, 
keep it on the screen!

[[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] problem setting default timezone

2015-04-23 Thread Bos, Roger
Dear All,

I would like to learn the proper way to set the default time zone so I get the 
correct date for my files.  The code below is non-reproducible (sorry) because 
it is based on a file on my system, but I hope someone will be able to help me 
anyway.

I have a file that was last modified on 4/21/2015:

> file.info("E:/snap/q/snap_q_q1_" %+% endPeriod %+% ".txt")$mtime
[1] "2015-04-21 20:26:33 EDT"

When I convert that to a date, I gives me 2015-04-22.  I read about timezones 
and saw that there are two possible places to set the default values: One as a 
system variable and one as an option.  To be safe I set both:

> Sys.setenv(TZ='America/New_York')
> Sys.getenv("TZ")
[1] "America/New_York"
> options(tz='America/New_York')
> getOption("tz")
[1] "America/New_York"
> as.Date(file.info("E:/snap/q/snap_q_q1_" %+% endPeriod %+% ".txt")$mtime)
[1] "2015-04-22"

But as you can see R still gives me the wrong date.  I can get the correct date 
as follows:

> as.Date(file.info("E:/snap/q/snap_q_q1_" %+% endPeriod %+% ".txt")$mtime, 
> tz='America/New_York')
[1] "2015-04-21"

But my question is why is the as.Date function not using the timezone I have 
set?

Thank you in advance,
Roger


***
This message and any attachments are for the named person's use only.
This message may contain confidential, proprietary or legally privileged
information. No right to confidential or privileged treatment
of this message is waived or lost by an error in transmission.
If you have received this message in error, please immediately
notify the sender by e-mail, delete the message, any attachments and all
copies from your system and destroy any hard copies. You must
not, directly or indirectly, use, disclose, distribute,
print or copy any part of this message or any attachments if you are not
the intended recipient.


__
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] - Obtaining superscripts to affix to means that are not significantly different from each other with R

2015-04-23 Thread David L Carlson
The function cld() in package multcomp generates compact letter displays, but 
does not format them as exponents of the group names.

-
David L Carlson
Department of Anthropology
Texas A&M University
College Station, TX 77840-4352

-Original Message-
From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Joachim 
Audenaert
Sent: Thursday, April 23, 2015 4:58 AM
To: r-help@r-project.org
Subject: [R] - Obtaining superscripts to affix to means that are not 
significantly different from each other with R

Hello all,

It is often time consuming to interpret p-values of multiple pairwise 
comparisons of groups and assign them a letter code for publication 
purposes. So I found this interesting link to a program that does this for 
you. 

http://www.jerrydallal.com/lhsp/similar.htm

I was wondering if something similar exists in R?


Met vriendelijke groeten - With kind regards,

Joachim Audenaert 
onderzoeker gewasbescherming - crop protection researcher

PCS | proefcentrum voor sierteelt - ornamental plant research

Schaessestraat 18, 9070 Destelbergen, Belgi�
T: +32 (0)9 353 94 71 | F: +32 (0)9 353 94 95
E: joachim.audena...@pcsierteelt.be | W: www.pcsierteelt.be   

Heb je je individuele begeleiding bemesting (CVBB) al aangevraagd? | Het 
PCS op LinkedIn
Disclaimer | Please consider the environment before printing. Think green, 
keep it on the screen!
[[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] create function to plot high density data using lattice

2015-04-23 Thread Luigi Marongiu
Dear all,
with the most useful help of Duncan I updated a script to plot high
density data in the form of 384 squares containing tiny plots. The
function works and it is possible to create a pdf version of the
output. but when i try to make a function out of this script, the
resulting pdf file is empty.
Any tips?
Thank you and best regards,
Luigi


 >>> here is the example:


DF <-  data.frame(Y = rnorm(17280),
 X = rnorm(1:45),
 Y2 = rnorm(17280)+2,
 Z  = 1:384)
plot.layout <- function(DF) {

# this works from here...
pdf(
  file = "TITLE-amp outlook.pdf",
  width = 15,
  height = 11,
  onefile = TRUE,
  family = "Helvetica",
  paper = "a4r"
)
xyplot(Y ~ X | Z,
   data = DF,
   groups = Z,
   allow.multiple = TRUE,
   ylab= "Y VALUES",
   xlab="X VALUES",
   main="TITLE",
   scales = list(
 x = list(draw = FALSE),
 y = list(draw = FALSE),
 relation="same",
 alternating=TRUE),
   as.table = TRUE,
   layout = c(24,16),
   par.settings = list(
 strip.background=list(col="white"),
 axis.text = list(cex = 0.6),
 par.xlab.text = list(cex = 0.75),
 par.ylab.text = list(cex = 0.75),
 par.main.text = list(cex = 0.8),
 superpose.symbol = list(type = "l", cex = 1)
   ),
   strip= FALSE,
   type = "l",
   col = 3,
   panel = panel.superpose
)
dev.off()
#... till here

}
plot.layout(DF)

__
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] Warning message when starting RStudio

2015-04-23 Thread Albin Blaschka

Hello

Am 23.04.2015 um 09:57 schrieb Berend Hasselman:



On 23-04-2015, at 08:45, Sun Shine  wrote:

Hi list

Recently, when starting up RStudio, the following warning is being displayed:

"Error in tools:::httpdPort <= 0L :
comparison (4) is possible only for atomic and list types"

I think that this is specific to RStudio because starting R in a terminal 
window doesn't produce this message.

Does anyone have an idea on how to clear the conditions that are giving rise to 
this warning?


Upgrade R-Studio, it is a problem in the interaction between R and 
R-Studio, which was solved with the new version of R-Studio... I had the 
same problem...


HTH,
Albin


--
| Dr.rer.nat. Albin Blaschka
| Etrichstrasse 26, A-5020 Salzburg
| * www.albinblaschka.info *
| * www.researchgate.net/profile/Albin_Blaschka *
| - It's hard to live in the mountains, hard but not hopeless!

__
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] Selecting cell values with XLSX package

2015-04-23 Thread Jim Lemon
Hi samarvir,
Your attachment didn't make it through the list filter. From your
example, you seem to want something like this:

# assume you are using the readxl package to read the data in
mydf<-read_excel("mydata.xlsx",col_types=rep("character",11))
mydatavector<-as.vector(as.matrix(mydf))

This is probably not what you need, as each spreadsheet file will be
turned into a long vector of character (string) values. What you
probably should think of is reading in the spreadsheets:

mydf1<-read_excel("mydata1.xlsx")
mydf2...

and merging the resulting data frames. With that many data files, you
will probably have to do this in stages.

Jim


On Thu, Apr 23, 2015 at 9:36 PM, samarvir singh  wrote:
> Hello,
>
> I am working with some 2700 files in .xlsx format
> Like the one attached below
>
> I want to transform all tabular data to a single row as shown below in
> example or in attachment
> so that all data can be used as a variable.
> and replicate all to make a single csv file which has all the data
>
> EXAMPLE
>
>   company SALE-9 SALE-8 SALE-7 SALE-6 SALE-5 SALE-4 SALE-3 SALE-2 SALE-1
> SALE op-9  MARUTI SUZUKI INDIA LIMITED 11046.3 12197.9 14806.4 18066.8
> 20729.4 29317.7 36618.4 35587.1 43587.9 43700.6 1570.3  Nextcompany name …
>
> Thanks for your help. help me however you can.
>  Really appreciate you taking the time.
> please see the attachment. thank you.
> I would love to share the findings, Whatever I can find.
> P.S - every file is of same format
>
>  thank you.
> __
> 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-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] Hmisc::rcorr inconsistency?

2015-04-23 Thread Keith.Jewell
(Copied to maintainer)

I'm not going to say there's an error in such an established and respected 
package but I think there's an inconsistency between the help text and the 
example:

> ?rcorr
   
Value
   
The diagonals of n are the number of non-NAs for the single variable 
corresponding to that row and column.

> example(rcorr)
   
rcorr> z <- c(1,   2, 3, 4, NA)  # number of non-NAs for z = 4
   
n
  x y z v
x 5 5 4 5
y 5 5 4 5
z 4 4 5 4  # diagonal for z = 5
v 5 5 4 5

Is this an error in the documentation or the code?
Or am I misunderstanding something?

Keith Jewell –Statistics Group
Campden BRI Group
www.campdenbri.co.uk



The information in this document and attachments is given after the exercise of 
all reasonable care and skill in its compilation, preparation and issue, but is 
provided without liability in its application or use. It may contain privileged 
information that is exempt from disclosure by law and may be confidential. If 
you are not the intended recipient you must not copy, distribute or take any 
action in reliance on it. If you have received this document in error please 
notify us and delete this message from your system immediately.

Unless otherwise expressly agreed in writing and signed by a duly authorised 
representative of Campden BRI, all goods & services procured and provided by 
Campden BRI shall be subject to our relevant Standard Terms and Conditions 
copies of which are available on request or can be downloaded from our website 
at http://www.campdenbri.co.uk/campdenbri/terms.php

• In the event of supplying technical services, such services shall be subject 
to Campden BRI Standard Terms and Conditions of Supply of Goods/Services.

• In the event of supplying training, conferences, seminars and events, such 
services shall be subject to Campden BRI Standard Terms and Condition for the 
Supply of Training including Conferences, Seminars and Events.

• In the event of our procurement of goods and services, such goods and 
services shall be provided subject to Campden BRI Standard Terms and Conditions 
of Purchase of Goods and/or Services.

Companies (trading) within the Campden BRI Group:
Campden BRI (private company limited by guarantee, registered number 510618)
Campden BRI (Chipping Campden) Limited (private company limited by shares, 
registered number 3836922)
Campden BRI (Nutfield) (private company limited by guarantee, registered number 
2690377)

All companies are registered in England and Wales with the registered office at 
Station Road, Chipping Campden, Gloucestershire, GL55 6LD.

The Campden BRI Group may monitor e-mail traffic data and also the content of 
e-mail for the purposes of security and staff training.


This e-mail has been scanned for all viruses by MessageLabs.

__
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] Selecting cell values with XLSX package

2015-04-23 Thread samarvir singh
Hello,

I am working with some 2700 files in .xlsx format
Like the one attached below

I want to transform all tabular data to a single row as shown below in
example or in attachment
so that all data can be used as a variable.
and replicate all to make a single csv file which has all the data

EXAMPLE

  company SALE-9 SALE-8 SALE-7 SALE-6 SALE-5 SALE-4 SALE-3 SALE-2 SALE-1
SALE op-9  MARUTI SUZUKI INDIA LIMITED 11046.3 12197.9 14806.4 18066.8
20729.4 29317.7 36618.4 35587.1 43587.9 43700.6 1570.3  Nextcompany name …

Thanks for your help. help me however you can.
 Really appreciate you taking the time.
please see the attachment. thank you.
I would love to share the findings, Whatever I can find.
P.S - every file is of same format

 thank you.
__
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] geom_errorbar() issue in ggplot2

2015-04-23 Thread Thierry Onkelinx
In this case the horizontal lines of the errorbars go output the limits.
And are therefore not displayed. Use coord_cartesian(xlim = 0:1) instead of
setting the limits in scale_x_continuous().

ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature and
Forest
team Biometrie & Kwaliteitszorg / team Biometrics & Quality Assurance
Kliniekstraat 25
1070 Anderlecht
Belgium

To call in the statistician after the experiment is done may be no more
than asking him to perform a post-mortem examination: he may be able to say
what the experiment died of. ~ Sir Ronald Aylmer Fisher
The plural of anecdote is not data. ~ Roger Brinner
The combination of some data and an aching desire for an answer does not
ensure that a reasonable answer can be extracted from a given body of data.
~ John Tukey

2015-04-23 12:23 GMT+02:00 Axel Urbiz :

> Thanks Thierry. So if a variable x = a, and the limits for x are [a, a+b],
> is that data point considered outside the limits?
>
> Thanks,
> Axel.
>
> On Thu, Apr 23, 2015 at 6:17 AM, Thierry Onkelinx <
> thierry.onkel...@inbo.be> wrote:
>
>> The limits are more narrow than the data. ggplot2 treats data outside the
>> limits as NA.
>>
>> ir. Thierry Onkelinx
>> Instituut voor natuur- en bosonderzoek / Research Institute for Nature
>> and Forest
>> team Biometrie & Kwaliteitszorg / team Biometrics & Quality Assurance
>> Kliniekstraat 25
>> 1070 Anderlecht
>> Belgium
>>
>> To call in the statistician after the experiment is done may be no more
>> than asking him to perform a post-mortem examination: he may be able to say
>> what the experiment died of. ~ Sir Ronald Aylmer Fisher
>> The plural of anecdote is not data. ~ Roger Brinner
>> The combination of some data and an aching desire for an answer does not
>> ensure that a reasonable answer can be extracted from a given body of data.
>> ~ John Tukey
>>
>> 2015-04-23 12:06 GMT+02:00 Axel Urbiz :
>>
>>> Hello,
>>>
>>> I'm getting a warning message from the reproducible example below.
>>>
>>> Why would geom_errorbar() remove 2 cases in this case? Both upper and
>>> lower
>>> limits of the error bar contain var1 and are within the axis limits.
>>>
>>>
>>> df <- data.frame(var1 = seq(0, 1, 0.1), var2 = seq(0, 1, 0.1))
>>> df$ll <- ifelse(df$var1 == 0, 0, df$var1 - 0.05)
>>> df$ul <- ifelse(df$var1 == 1, 1, df$var1 + 0.05)
>>> pp1 <- ggplot(data = df,
>>> aes(x = var2, y = var1)) +
>>> geom_line() + geom_point() +
>>> scale_x_continuous(limits = c(0, 1), breaks = seq(0, 1,
>>> 0.1)) +
>>> scale_y_continuous(limits = c(0, 1), breaks = seq(0, 1, 0.1))
>>> pp1
>>> pp2 <- pp1 + geom_errorbar(data=df,
>>>   aes(ymin=ll,ymax=ul), width=0.02)
>>> pp2
>>> Warning message:
>>> In loop_apply(n, do.ply) :
>>>   Removed 2 rows containing missing values (geom_path).
>>> >
>>>
>>> Thanks for any pointers.
>>>
>>> Best,
>>> Axel.
>>>
>>> [[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] geom_errorbar() issue in ggplot2

2015-04-23 Thread Axel Urbiz
Thanks Thierry. So if a variable x = a, and the limits for x are [a, a+b],
is that data point considered outside the limits?

Thanks,
Axel.

On Thu, Apr 23, 2015 at 6:17 AM, Thierry Onkelinx 
wrote:

> The limits are more narrow than the data. ggplot2 treats data outside the
> limits as NA.
>
> ir. Thierry Onkelinx
> Instituut voor natuur- en bosonderzoek / Research Institute for Nature and
> Forest
> team Biometrie & Kwaliteitszorg / team Biometrics & Quality Assurance
> Kliniekstraat 25
> 1070 Anderlecht
> Belgium
>
> To call in the statistician after the experiment is done may be no more
> than asking him to perform a post-mortem examination: he may be able to say
> what the experiment died of. ~ Sir Ronald Aylmer Fisher
> The plural of anecdote is not data. ~ Roger Brinner
> The combination of some data and an aching desire for an answer does not
> ensure that a reasonable answer can be extracted from a given body of data.
> ~ John Tukey
>
> 2015-04-23 12:06 GMT+02:00 Axel Urbiz :
>
>> Hello,
>>
>> I'm getting a warning message from the reproducible example below.
>>
>> Why would geom_errorbar() remove 2 cases in this case? Both upper and
>> lower
>> limits of the error bar contain var1 and are within the axis limits.
>>
>>
>> df <- data.frame(var1 = seq(0, 1, 0.1), var2 = seq(0, 1, 0.1))
>> df$ll <- ifelse(df$var1 == 0, 0, df$var1 - 0.05)
>> df$ul <- ifelse(df$var1 == 1, 1, df$var1 + 0.05)
>> pp1 <- ggplot(data = df,
>> aes(x = var2, y = var1)) +
>> geom_line() + geom_point() +
>> scale_x_continuous(limits = c(0, 1), breaks = seq(0, 1, 0.1))
>> +
>> scale_y_continuous(limits = c(0, 1), breaks = seq(0, 1, 0.1))
>> pp1
>> pp2 <- pp1 + geom_errorbar(data=df,
>>   aes(ymin=ll,ymax=ul), width=0.02)
>> pp2
>> Warning message:
>> In loop_apply(n, do.ply) :
>>   Removed 2 rows containing missing values (geom_path).
>> >
>>
>> Thanks for any pointers.
>>
>> Best,
>> Axel.
>>
>> [[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] geom_errorbar() issue in ggplot2

2015-04-23 Thread Thierry Onkelinx
The limits are more narrow than the data. ggplot2 treats data outside the
limits as NA.

ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature and
Forest
team Biometrie & Kwaliteitszorg / team Biometrics & Quality Assurance
Kliniekstraat 25
1070 Anderlecht
Belgium

To call in the statistician after the experiment is done may be no more
than asking him to perform a post-mortem examination: he may be able to say
what the experiment died of. ~ Sir Ronald Aylmer Fisher
The plural of anecdote is not data. ~ Roger Brinner
The combination of some data and an aching desire for an answer does not
ensure that a reasonable answer can be extracted from a given body of data.
~ John Tukey

2015-04-23 12:06 GMT+02:00 Axel Urbiz :

> Hello,
>
> I'm getting a warning message from the reproducible example below.
>
> Why would geom_errorbar() remove 2 cases in this case? Both upper and lower
> limits of the error bar contain var1 and are within the axis limits.
>
>
> df <- data.frame(var1 = seq(0, 1, 0.1), var2 = seq(0, 1, 0.1))
> df$ll <- ifelse(df$var1 == 0, 0, df$var1 - 0.05)
> df$ul <- ifelse(df$var1 == 1, 1, df$var1 + 0.05)
> pp1 <- ggplot(data = df,
> aes(x = var2, y = var1)) +
> geom_line() + geom_point() +
> scale_x_continuous(limits = c(0, 1), breaks = seq(0, 1, 0.1)) +
> scale_y_continuous(limits = c(0, 1), breaks = seq(0, 1, 0.1))
> pp1
> pp2 <- pp1 + geom_errorbar(data=df,
>   aes(ymin=ll,ymax=ul), width=0.02)
> pp2
> Warning message:
> In loop_apply(n, do.ply) :
>   Removed 2 rows containing missing values (geom_path).
> >
>
> Thanks for any pointers.
>
> Best,
> Axel.
>
> [[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] geom_errorbar() issue in ggplot2

2015-04-23 Thread Axel Urbiz
Hello,

I'm getting a warning message from the reproducible example below.

Why would geom_errorbar() remove 2 cases in this case? Both upper and lower
limits of the error bar contain var1 and are within the axis limits.


df <- data.frame(var1 = seq(0, 1, 0.1), var2 = seq(0, 1, 0.1))
df$ll <- ifelse(df$var1 == 0, 0, df$var1 - 0.05)
df$ul <- ifelse(df$var1 == 1, 1, df$var1 + 0.05)
pp1 <- ggplot(data = df,
aes(x = var2, y = var1)) +
geom_line() + geom_point() +
scale_x_continuous(limits = c(0, 1), breaks = seq(0, 1, 0.1)) +
scale_y_continuous(limits = c(0, 1), breaks = seq(0, 1, 0.1))
pp1
pp2 <- pp1 + geom_errorbar(data=df,
  aes(ymin=ll,ymax=ul), width=0.02)
pp2
Warning message:
In loop_apply(n, do.ply) :
  Removed 2 rows containing missing values (geom_path).
>

Thanks for any pointers.

Best,
Axel.

[[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] - Obtaining superscripts to affix to means that are not significantly different from each other with R

2015-04-23 Thread Joachim Audenaert
Hello all,

It is often time consuming to interpret p-values of multiple pairwise 
comparisons of groups and assign them a letter code for publication 
purposes. So I found this interesting link to a program that does this for 
you. 

http://www.jerrydallal.com/lhsp/similar.htm

I was wondering if something similar exists in R?


Met vriendelijke groeten - With kind regards,

Joachim Audenaert 
onderzoeker gewasbescherming - crop protection researcher

PCS | proefcentrum voor sierteelt - ornamental plant research

Schaessestraat 18, 9070 Destelbergen, Belgi�
T: +32 (0)9 353 94 71 | F: +32 (0)9 353 94 95
E: joachim.audena...@pcsierteelt.be | W: www.pcsierteelt.be   

Heb je je individuele begeleiding bemesting (CVBB) al aangevraagd? | Het 
PCS op LinkedIn
Disclaimer | Please consider the environment before printing. Think green, 
keep it on the screen!
[[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] Warning message when starting RStudio

2015-04-23 Thread Berend Hasselman

> On 23-04-2015, at 08:45, Sun Shine  wrote:
> 
> Hi list
> 
> Recently, when starting up RStudio, the following warning is being displayed:
> 
> "Error in tools:::httpdPort <= 0L :
> comparison (4) is possible only for atomic and list types"
> 
> I think that this is specific to RStudio because starting R in a terminal 
> window doesn't produce this message.
> 
> Does anyone have an idea on how to clear the conditions that are giving rise 
> to this warning?
> 

Not me.
But this doesn’t belong here. You should post on a Rstudio forum.

Berend

> Many thanks
> Sun
> 
> __
> 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-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.