[R] new question

arun smartpink111 at yahoo.com
Thu Mar 21 16:29:51 CET 2013


Sorry, I am not sure I understand your question.  

You have 5 boxplots(if I remember correctly) on a single page and these 5 boxplots have titles "a1","a2","c1","c2","t1" (or something like that). 

Could you try:
par(mfcol(c(3,2)) and see if that helps. (not tested)
A.K.






________________________________
From: Vera Costa <veracosta.rt at gmail.com>
To: arun <smartpink111 at yahoo.com> 
Sent: Thursday, March 21, 2013 11:24 AM
Subject: Re: new question


Hi.

Thank you your help and sorry only answer now. 

Ok, the boxplots is ok. But I need too by group... on par(mfrow(c(2,2))), I can have par(mfrow(c(3,2)), for example (or more) and have a boxplot for the group. You can help me to group them?

About the other function I need to do other things, but now I need to think what to do...

Thank you





2013/3/18 arun <smartpink111 at yahoo.com>


>
>
> z.boxplot<- function(lst){
> new.list<-  lapply(lst,function(x) x[x$FDR<0.01,])
>print(new.list)
>  par(mfrow=c(2,2))
>b1<-lapply(names(new.list),function(x) lapply(new.list[x],function(y) boxplot(FDR~z,data=y,xlab="Charge",ylab="FDR",main=x)))
>
>}
> z.boxplot(ListFacGroup) #prints new.list
>
>If you want to turn off that:
>
> z.boxplot<- function(lst){
> new.list<-  lapply(lst,function(x) x[x$FDR<0.01,])
>#print(new.list)
>  par(mfrow=c(2,2))
>b1<-lapply(names(new.list),function(x) lapply(new.list[x],function(y) boxplot(FDR~z,data=y,xlab="Charge",ylab="FDR",main=x)))
>
>
>}
> z.boxplot(ListFacGroup)
>A.K.
>
>
>
>
>
>________________________________
>From: Vera Costa <veracosta.rt at gmail.com>
>To: arun <smartpink111 at yahoo.com>
>Sent: Monday, March 18, 2013 1:59 PM
>Subject: Re: new question
>
>
>
>For example, if I run you code without "pdf...." and "dev.off" I have what I want
>
>directory<- "C:/Users/Vera Costa/Desktop/dados.lixo"
> #modified the function
>GetFileList <- function(directory,number){
>  setwd(directory)
>  filelist1<-dir()
>
>    lista<-dir(directory,pattern = paste("MSMS_",number,"PepInfo.txt",sep=""), full.names = TRUE, recursive = TRUE)
>      output<- list(filelist1,lista)
>  return(output)
>     }
>file.list.names<-GetFileList(directory,23)[[1]]
>lista<-GetFileList(directory,23)[[2]]
>FacGroup<-c(0,1,0,2,2,0,3)
>ReadDir<-function(FacGroup){
>  list.new<-lista[FacGroup!=0]
>  read.list<-lapply(list.new, function(x) read.table(x,header=TRUE, sep = "\t"))
>  names(read.list)<-file.list.names[FacGroup!=0]
>  return (read.list)
> }
>ListFacGroup<-ReadDir(FacGroup)
>ListFacGroup
> z.boxplot<- function(lst){
> new.list<-  lapply(lst,function(x) x[x$FDR<0.01,])
> print(new.list)
> #pdf("VeraBP.pdf")
> par(mfrow=c(2,2))
> lapply(names(new.list),function(x) lapply(new.list[x],function(y) boxplot(FDR~z,data=y,xlab="Charge",ylab="FDR",main=x)))
> #dev.off()
> }
> z.boxplot(ListFacGroup)
>
>
>
>
>
>But I have the results too (I don't need it)
>
>
>[[1]]
>[[1]]$a2
>[[1]]$a2$stats
>             [,1]         [,2]
>[1,] 0.0000000000 0.0000000000
>[2,] 0.0000000000 0.0000000000
>[3,] 0.0001355197 0.0002175095
>[4,] 0.0010588777 0.0004350190
>[5,] 0.0016571381 0.0004350190
>[[1]]$a2$n
>[1] 8 2
>[[1]]$a2$conf
>              [,1]          [,2]
>[1,] -0.0004559846 -0.0002685062
>[2,]  0.0007270240  0.0007035253
>[[1]]$a2$out
>[1] 0.00494012
>[[1]]$a2$group
>[1] 1
>[[1]]$a2$names
>[1] "2" "3"
>
>[[2]]
>[[2]]$c2
>[[2]]$c2$stats
>             [,1]         [,2]
>[1,] 0.0000000000 0.0000000000
>[2,] 0.0000000000 0.0000000000
>[3,] 0.0001355197 0.0002175095
>[4,] 0.0010588777 0.0004350190
>[5,] 0.0016571381 0.0004350190
>[[2]]$c2$n
>[1] 8 2
>[[2]]$c2$conf
>              [,1]          [,2]
>[1,] -0.0004559846 -0.0002685062
>[2,]  0.0007270240  0.0007035253
>[[2]]$c2$out
>[1] 0.00494012
>[[2]]$c2$group
>[1] 1
>[[2]]$c2$names
>[1] "2" "3"
>
>[[3]]
>[[3]]$c3
>[[3]]$c3$stats
>            [,1]         [,2]
>[1,] 0.000000000 0.0000000000
>[2,] 0.000000000 0.0000000000
>[3,] 0.000000000 0.0000000000
>[4,] 0.002226409 0.0002086594
>[5,] 0.002226409 0.0004173187
>[[3]]$c3$n
>[1] 6 4
>[[3]]$c3$conf
>             [,1]          [,2]
>[1,] -0.001436105 -0.0001648409
>[2,]  0.001436105  0.0001648409
>[[3]]$c3$out
>[1] 0.00560348
>[[3]]$c3$group
>[1] 1
>[[3]]$c3$names
>[1] "2" "3"
>
>[[4]]
>[[4]]$t2
>[[4]]$t2$stats
>     [,1]         [,2] [,3]
>[1,]    0 0.0000000000    0
>[2,]    0 0.0000000000    0
>[3,]    0 0.0002908668    0
>[4,]    0 0.0025929827    0
>[5,]    0 0.0052577771    0
>[[4]]$t2$n
>[1]  1 10  5
>[[4]]$t2$conf
>     [,1]         [,2] [,3]
>[1,]    0 -0.001004691    0
>[2,]    0  0.001586424    0
>[[4]]$t2$out
>[1] 0.0092051934 0.0007174888
>[[4]]$t2$group
>[1] 2 3
>[[4]]$t2$names
>[1] "1" "2" "3"
>      



More information about the R-help mailing list