Bioconductor Digest, Vol 29, Issue 18
0
0
Entering edit mode
@gordon-smyth
Last seen 51 minutes ago
WEHI, Melbourne, Australia
> 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
• 726 views
ADD COMMENT

Login before adding your answer.

Traffic: 698 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6