[BioC] Bioconductor Digest, Vol 29, Issue 18
Gordon K Smyth
smyth at wehi.EDU.AU
Tue Jul 19 13:27:36 CEST 2005
> Date: Mon, 18 Jul 2005 14:34:36 -0400
> From: Guoneng Zhong <guoneng.zhong at yale.edu>
> Subject: [BioC] writing weight function
> To: "bioconductor at stat.math.ethz.ch" <bioconductor at stat.math.ethz.ch>
>
> Hi,
>
> Has anyone written a weight function to be used with limma's
> read.maimages()? I tried this (based on typing wtflag):
>
> wtblank <- function(w=0.1)
> function(gpr){
> flagged <- (gpr[,"ID"] = "BLANK")
> w * flagged + (!flagged)
> }
>
> And here are the errors I got from two different tries:
>
> >
> RG<-read.maimages(targets$FileName,source="genepix",columns=list(Gf="F532
> Median",Gb="B532 Median",Rf="F635 Median",Rb="B635 Median"),wt.fun=wtblank)
> Error in "[<-"(`*tmp*`, , i, value = function (gpr) :
> number of items to replace is not a multiple of replacement length
> >
> RG<-read.maimages(targets$FileName,source="genepix",columns=list(Gf="F532
> Median",Gb="B532 Median",Rf="F635 Median",Rb="B635
> Median"),wt.fun=wtblank(0))
> Error in w * flagged : non-numeric argument to binary operator
>
> What am I doing wrong?
help("==") will tell you what is wrong with your code.
But modelling your function on wtflag has made it harder than it needs to be. Just
wtblank <- function(x) 1-as.numeric(x$ID=="" | x$ID=="BLANK")
would be enough.
Gordon
> Thanks,
> G
More information about the Bioconductor
mailing list