On 09/10/2009 12:42 AM, guangchuang yu wrote:> I used *lapply* and *for* to call the function *GetC* respectively. The
> output is different!!! I can't figured out how this happen! It's so
wierd.
>
>
>> x=lapply(ipi.go,GetC, ont = "BP", org=cell.cycle)
>> unlist(x)
> *IPI00011654 IPI00013683
> "cell cycle" "cell cycle"*
>
>> categorate=list()
>> for (i in 1:length(ipi.go)) {
> + x = GetC(ipi.go[i], ont="BP", org=cell.cycle)
lapply will apply the function to ipi.go[[i]], not ipi.go[i].
Duncan Murdoch
> + x <- list(x)
> + names(x) <- names(ipi.go[i])
> + categorate <- c(categorate, x)
> + }
>> unlist(categorate)
> *IPI00003865 IPI00011654 IPI00013475 IPI00013683
> "cell cycle" "cell cycle" "cell cycle"
"cell cycle"
> *
>