Entering edit mode
On Tue, 19 Mar 2002, Rafael A. Irizarry wrote:
> show for "empty" phenoData gives errors:
>
> > new("phenoData")
> phenoData object with variables and cases
> varLabels
> Error in vL[[i]] : subscript out of bounds
ok, but a better approach is to introduce a validity
checking method to prevent such phenoData objects
from ever being created
see setValidity under methods
we need to get into this habit.
>
>
> here is an easy fix adding a if-else
>
> setMethod("show", "phenoData",
> function(object) {
> dm <- dim(object@pData)
> if(is.null(dm)) cat("Empty\n")
> else{
> cat("\t phenoData object with ", dm[2], "
variables",
> sep="")
> cat(" and ", dm[1], " cases\n", sep="")
> vL <- object@varLabels
> cat("\t varLabels\n")
> nm <- names(vL)
> for(i in 1:length(vL) )
> cat("\t\t", nm[[i]], ": ", vL[[i]], "\n",
sep="")
> }
> }, where=where)
>
>
>
> _______________________________________________
> Biocore mailing list
> Biocore@stat.math.ethz.ch
> http://www.stat.math.ethz.ch/mailman/listinfo/biocore
>