[R] plot in package psych with function error.bars.by

William Revelle lists at revelle.net
Sat Jun 7 22:10:18 CEST 2014


Tham and Jim,
  As usual, my first response to this is when you find a problem with the psych package, write me (as author) as well as the R-help list.

In addition, always include which version of psych you are running.  That will help in the debugging.  The current version 1.4.5 on CRAN draws “cats eyes” instead of error bars, unless you turn off that option.
You might find that useful.


Then, my comment to Tham,

Yes, you have found a weakness (some would say a bug) in that I currently default the base plot character to be 15. I will correct this in the next release (which won’t be shipped to CRAN until mid to late July).  In the interim, I will try to get a fix up on the personality-project.org/r  repository by early next week.

To Jim,  I can not get your error at all.  Tham was finding a problem with the basic example, which works, unless you try to specify the pch, which doesn’t work.

Bill





On Jun 3, 2014, at 4:10 PM, Jim Lemon <jim at bitwrit.com.au> wrote:

> On Mon, 2 Jun 2014 11:28:19 PM Tham Tran wrote:
>> Hi,
>> 
>> I have a problem with the function "error.bars.by" in package 
> "psych".
>> This is the code for example of a graph:
>> 
>> 
> keys.list=list(Agree=c(-1,2:5),Conscientious=c(6:8,-9,-10),Extraversion=c(-1
>> 1,-12,13:15),Neuroticism=c(16:20),Openness = 
> c(21,-22,23,24,-25))
>> keys = make.keys(28,keys.list,item.labels=colnames(bfi))
>> scores = score.items(keys,bfi,min=1,max=6)
>> require(psych)
>> error.bars.by(scores$scores,round(bfi$age/10)*10,by.var=TRUE,
>> main="BFI age trends",legend=3,labels=colnames(scores$scores),
>> xlab="Age",ylab="Mean item score")
>> 
>> I need to change the plotting character and line type of the graph 
> according
>> to the scores (Agree,Conscientious,Extraticism,Openness).
>> 
>> I have tried with:
>> error.bars.by(scores$scores,round(bfi$age/10)*10,by.var=TRUE,
>> main="BFI age trends",legend=3,labels=colnames(scores$scores),
>> pch=c(1,2,3,4), lty=1
>> ,xlab="Age",ylab="Mean item score")
>> 
>> But there is a problem:
>> Error in localWindow(xlim, ylim, log, asp, ...) :  formal argument "pch"
>> matched by multiple actual arguments
>> 
>> Anyone can help me for this problem.
> 
> Hi Tham,
> When I run your example, I get the following error:
> 
> Error in seq.default(clim, -clim, 0.01) : 
>  'from' cannot be NA, NaN or infinite
> In addition: Warning messages:
> 1: In qt(1 - alpha/2, group.stats[[g]]$n - 1) : NaNs produced
> 2: In dt(ln, n - 1) : NaNs produced
> 3: In qt(alpha/2, n - 1) : NaNs produced
> 
> As I don't know what is happening here, I can't do anything about the 
> pch problem.
> 
> Jim
> 
> ______________________________________________
> R-help at r-project.org mailing list
> 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.
> 

William Revelle		           http://personality-project.org/revelle.html
Professor			           http://personality-project.org
Department of Psychology   http://www.wcas.northwestern.edu/psych/
Northwestern University	   http://www.northwestern.edu/
Use R for psychology             http://personality-project.org/r
It is 5 minutes to midnight	   http://www.thebulletin.org



More information about the R-help mailing list