Re: [R] How do you add the x-bar (mean of x) symbol and show a calculated mean in the title of a histogram?

2013-10-12 Thread Bert Gunter
Better, I don't know... But alternatively, and maybe thinning the fog a bit: set.seed(42) xxx - rnorm(300,10,2) hist(xxx,main=bquote(Heart~~Attackbar(x) == .(mean(xxx Cheers, Bert On Fri, Oct 11, 2013 at 10:23 PM, Rolf Turner r.tur...@auckland.ac.nz wrote: On 10/12/13 11:39, Emily

Re: [R] How do you add the x-bar (mean of x) symbol and show a calculated mean in the title of a histogram?

2013-10-12 Thread arun
Hi, A slight modification would be: hist(xxx,main=bquote(Heart Attack ~ bar(x) == .(mean(xxx #or use ?substitute() hist(xxx,main=substitute(Heart Attack ~ bar(x) == mx,list(mx=mean(xxx A.K. On Saturday, October 12, 2013 1:26 AM, Rolf Turner r.tur...@auckland.ac.nz wrote: On 10/12/13

Re: [R] using ddply with segmented regression

2013-10-12 Thread arun
Hi, Try: segmentf_df - function(df) { out.lm-lm(deltaWgt~Cycle, data=df) segmented(out.lm,seg.Z=~Cycle, psi=(Cycle=NA),control=seg.control(stop.if.error=FALSE,n.boot=0)) } library(plyr) library(segmented) dlply(df,.(Lot.Run),segmentf_df) $`J062431-1` Call: segmented.lm(obj = out.lm, seg.Z =

Re: [R] matrix values linked to vector index

2013-10-12 Thread arun
Modified Bert's solution for non-square matrices.  For the tested vectors, it worked.  There, could still be some bugs. x1- c(3,2,1,4)  x2- c(2,0,4,3,1) x3 - c(2, 1, 2.2) x4 - c(a,1,3) makeMat3 - function(x,n){     if(is.numeric(x)){ x - as.integer(round(x)) x}

Re: [R] Updating RSQLite fails

2013-10-12 Thread Milan Bouchet-Valat
Le vendredi 11 octobre 2013 à 18:49 +0200, Thibault Helleputte a écrit : Hello, Working on an ubuntu 13.04 with a sessionInfo() specified below, I try to update my packages, and RSQLite update consistently fails like this: update.packages(checkBuilt=TRUE, ask=FALSE) Warning: package

[R] Introductory screencast tutorials on R

2013-10-12 Thread kannan
We have created two introductory screencast tutorials on R, using RStudio, and released them under a CC license. These are available at http://www.spoken-tutorial.org/list_videos?view=1foss=Rlanguage=all - one may view them on a web browser or download them - without any registration, whatsoever.

[R] export glht to LaTeX

2013-10-12 Thread Winter, Jan-Christoph
Hi, I want to export the result of glht in R into a LaTeX table, such as that result: Linear Hypotheses: Estimate Std. Error z value Pr(|z|) Group1 - Group2 == 0 -0.140070.01589 -8.813 0.001 *** Group1 - Group3 == 0-0.09396

Re: [R] matrix values linked to vector index

2013-10-12 Thread Bert Gunter
This seems to do it, but as I mentioned in my original post, my solution was tricky. Thinking about it some more, I now realize that it was too tricky and has the additional flaw of using underlying representations of objects rather than their exposed interfaces -- i.e it treats a matrix as a

[R] Order of factors with facets in ggplot2

2013-10-12 Thread Lars Bishop
Hello, I'd like to produce a ggplot where the order of factors within facets is based on the average of another variable. Here's a reproducible example. My problem is that the factors are ordered similarly in both facets. I would like to have, within each facet of `f1', boxplots for 'x' within

Re: [R] matrix values linked to vector index

2013-10-12 Thread arun
This looks better.  My previous solution (makeMatrix2) also did the matrix indexing  without using sapply() route.  Replacing the max(x) by n for non-symmetric matrix: makeMatrix2- function(x,n){ #including n  if(is.numeric(x)){ x - as.integer(round(x)) x} stopifnot(is.integer(x)) m1-

Re: [R] matrix values linked to vector index

2013-10-12 Thread arun
Some speed comparison: set.seed(124)  xtest- sample(0:9,1e7,replace=TRUE) system.time({res1 - makemx(xtest,9)}) #   user  system elapsed # 51.124   0.812  52.039  system.time({res2 - makeMatrix2(xtest,9)}) #   user  system elapsed #  3.460   0.168   3.631 identical(res1,res2) #[1] TRUE

[R] Loop over factor returns NA

2013-10-12 Thread anna berg
Dear R users, I am pretty new to programming in R. So I guess there is some obvious mistake I am making. I hope you can help me. I have a data frame that looks like this: AB timexy z gene part 1 03:27:58 1 23grom

Re: [R] Introductory screencast tutorials on R

2013-10-12 Thread Grant Rettke
Thank you very much. On Fri, Oct 11, 2013 at 10:40 PM, kan...@iitb.ac.in wrote: We have created two introductory screencast tutorials on R, using RStudio, and released them under a CC license. These are available at http://www.spoken-tutorial.org/list_videos?view=1foss=Rlanguage=all - one

Re: [R] matrix values linked to vector index

2013-10-12 Thread arun
Apologies, in case it is double posting (I think my previous message didn't make it to the list) Hope the new version of `makeMat3` is bug free: makeMat3 - function(x,n){     if(is.numeric(x)){ x - as.integer(round(x)) x} stopifnot(is.integer(x)) if(length(x)=n max(x)=n){

Re: [R] Loop over factor returns NA

2013-10-12 Thread arun
Hi, Not sure if you have any restrictions in using ?lapply(). AB - read.table(text=   time    x    y  z    gene  part 1  03:27:58    1  2    3    grom    1 2  03:27:58    2  3    4    grom    1 3  03:27:58    3  4    5    grom 

Re: [R] Order of factors with facets in ggplot2

2013-10-12 Thread Ista Zahn
On Sat, Oct 12, 2013 at 12:01 PM, Lars Bishop lars...@gmail.com wrote: Hello, I'd like to produce a ggplot where the order of factors within facets is based on the average of another variable. Here's a reproducible example. My problem is that the factors are ordered similarly in both

Re: [R] Order of factors with facets in ggplot2

2013-10-12 Thread arun
Hi, As you using library(plyr), you may try: library(ggplot2) library(plyr) df2 - df d1 - dlply(df2,.(f1),function(u) {                 u$f2- reorder(u$f2,u$Avg_x)                 ggplot(mapping=aes(x=f2,y=x))+                

[R] lmerTest

2013-10-12 Thread srecko joksimovic
Hi, I'm trying to user lmer function from lmerTest package because, if I understood correectly, it allows to make better inference than lmer method from lme4 package. However, whatever I do I keep getting this error: Error in lme4::lFormula(formula = mark ~ ssCount + sTime+ : rank of X = 1660

Re: [R] lmerTest

2013-10-12 Thread Jeff Newmiller
Any idea what could be the problem? Hmmm... posting in html? No reproducible example? Not posting on R-sig-ME? Just some ideas... reading the Posting Guide might be helpful to you. --- Jeff Newmiller

Re: [R] lmerTest

2013-10-12 Thread srecko joksimovic
ok, ok... thanks. I'll try with R-sig-ME On Sat, Oct 12, 2013 at 5:43 PM, Jeff Newmiller jdnew...@dcn.davis.ca.uswrote: Any idea what could be the problem? Hmmm... posting in html? No reproducible example? Not posting on R-sig-ME? Just some ideas... reading the Posting Guide might be

Re: [R] export glht to LaTeX

2013-10-12 Thread Richard M. Heiberger
The trick for latexing glht objects is recognizing that they are very complex. It is necessary to isolate the part you want first, then the latex() function in Hmisc works very well. This example is based on one of the examples in ?glht library(Hmisc) library(multcomp) ### set up a one-way

Re: [R] Loop over factor returns NA

2013-10-12 Thread Jim Lemon
On 10/13/2013 02:12 AM, anna berg wrote: Dear R users, I am pretty new to programming in R. So I guess there is some obvious mistake I am making. I hope you can help me. I have a data frame that looks like this: AB timexy z gene part 1