Dear all, 
   
   
  I want to compute the average of the three blocks for each x-variable which is equal slide in the code below. How can I do that ?
   
   
  block  x1    x2    x3    x4    x5
  1        23    22   23    24    23
  1        21    25   26    21    39
  1        23    24    22    23   23
  2        20     21   23    24    28
  2       32     23    34     24   26
  2       19     34    34    13    34
  3       12     32  ´ 23    34    19
  3       23      24   25    26    27
  3       12     78   23    24    24
   
   
  # read table of data for this slide=(x1)
  a<-read.table(file = slide[i],header=T,sep='\t',na.strings="NA")
  #length(a$ID)
  #Eleminate Neg. and Pos. controls from the dataset. The logical negation of the "%in%" function, 
  #tells subset to only select those row where the "ID" column does not contain either "empty" or "none"
  new <- subset(a,!ID %in% c("empty","none"," "))
  #length(new$ID)
  #new[1:20,c(1,4,5,9)]
   
   
  #five first columns give position identifiers, include a column with block
  layout=new[,1:5]
  layout[1:30,]
   
  #9th columns which give the median foreground =values of x-variables
  fg1=as.matrix(new[,9])
  length(fg1)
  mean(fg1)  # calculate the mean of x1
   
   
   
  #### I try to do something like :##########
   
  block1=fg1[layout$Block==1,]
  block2=fg1[layout$Block==1,]
  block2=fg1[layout$Block==1,]
  average=(block1+block2+block3)/3
   
  but it did not work.
   
  ################## How can i calculate the means of remaining x_variables?
  #########   Read data for the remaining slides =x2,x3,x4,x5  ###########
   
  for (i in 2:num.slides){
  na1 <- strsplit(na[[i]][k],".txt")
  na2 <- strsplit(na1[[1]][1],"-")
  bat=na2[[1]][1]
  sli=na2[[1]][2]
  nslide <- cbind(nslide,as.numeric(sli))
  # nslide is a vector giving the number of the slide in the batch
  # read table of data for this slide
  a<-read.table(file=slide[i],header=T,sep='\t',na.strings="NA")
  new<- subset(a,!ID %in% c("empty","none"," "))
  # append FG data to the matrices containing the slides already read
  fg1=cbind(fg1,as.matrix(new[,9]))
  }
   
  colnames(fg1)=nslide
  fg<-data.frame(peptide=c(new$Name),fg1)
  fg <- edit(fg)
   
   
   
  ##### Another question : I have three graphs which are displayed one after one with a large space between them. Can I move these graph closer each other by making them bigger and how ? Below is the code that i have written for plotting the graphs.
   
  par(mfrow=c(3,1))
for (j in 1:3)
{
boxplot(split(pos$y[pos$Block==j],pos$Slide[pos$Block==j]), col="lightgray", cex=.65, outline=TRUE, main=paste("Positive Controls Block",j))
}

   
  Thank you for your help,
  Regards,
   
  Yen

	[[alternative HTML version deleted]]

