Entering edit mode
Stephen Henderson
★
1.0k
@stephen-henderson-71
Last seen 7.6 years ago
I'm having a few problems with using esApply.
Simply I have my exprSey data split into groups.
e.g.
>pData(SE.exprs)
sample group
SE 100503.CEL 1 1
SE 240503.CEL 2 1
SE 100503.CEL 3 2
SE 240503.CEL 4 2
SE 100503.CEL 5 3
SE 240503.CEL 6 3
SE 100503.CEL 7 4
SE 240503.CEL 8 4
I want to use esApply and the dist function to calculate "maximum"
distances
between any given group (for a simple filtering routine).
So..
>maxdiff<-function(x)
+ {
+ x<-as.data.frame(split(x,group))
## gives me a list object x like
$"1007_s_at"
cMSC MAPC MSC rcMSC
SE cMSC 28f 100503.CEL 8.675171 8.607033 8.973225 8.805668
SE CMSC 40YMALE 240503.CEL 8.681846 8.578437 8.868079 8.509754
... etc.
## so then I wish to calculate the distances (max) between
columns/groups
+ dist(t(x),"maximum")}
## and use esApply to calculate it for each gene
>esApply(SE.exprs,1, maxdiff)
Error in array(ans, c(len.a%/%d2, d.ans), if (is.null(dn.ans)) { :
length of dimnames[1] not equal to array extent
# gives an error because it's a list-- obviously I can extract it
using
# t(x$1007_s_at) for the first case but how do I do this for each and
every
# case?
# or simply is their another function to coerce the vector x into a
# data.frame without going through a list. I hope that's clear!
Stephen Henderson
WIBR
**********************************************************************
This email and any files transmitted with it are confidential an...
{{dropped}}