attempted merge() returns: cannot coerce type 'closure' to vector of type 'any'
On 12/2/2010 11:36 AM, David Winsemius wrote:
On Dec 2, 2010, at 5:22 AM, Karl Brand wrote:
Cheers Bill. You got me halfway, since:
temp <- merge(x=x, y=y[,17, drop=FALSE], by="rownames", sort=FALSE)
Error in fix.by(by.x, x) : 'by' must specify valid column(s) but, using "row.names" instead of "rownames", like:
temp <- merge(x=x, y=y[,17, drop=FALSE], by="row.names", sort=FALSE)
works (but adds a column "Row.names"). Which seems some what counter intuitive to me since i am feeding in two matrices to the merge function, which i understand have 'rownames', not 'row.names' as data frames have, right? Although the output of merge() is a data frame...
This reminds me of physicists using high energy particles to investigate the structure of the nucleus. But you have alternatives to what might be called "destructive debugging through binoculars". Instead of throwing code at your data and asking the assembled audience of soothsayers to tell you what went wrong by examining the debris, why don't you show us what the data objects actually look like?
Ofcourse David, sorry- my lazy. Is str() enough to put away the binoculuars and maybe highlight the source of my ignorance? > str(x) num [1:140, 1:7] 4.93e-02 2.83e-02 1.07e-02 2.68e-02 3.92e-05 ... - attr(*, "dimnames")=List of 2 ..$ : chr [1:140] "1415743_at" "1415887_at" "1416332_at" "1416340_a_at" ... ..$ : chr [1:7] "R.S.adj.pvalue" "R.S.Tau" "R.S.xpiek" "R.S.xdal" ... > str(y) num [1:140, 1:18] 0.573 1 0.752 0.768 0.399 ... - attr(*, "dimnames")=List of 2 ..$ : chr [1:140] "1427982_s_at" "1430520_at" "1454086_a_at" "1419652_s_at" ... ..$ : chr [1:18] "R.S.1" "R.S.2" "R.S.3" "R.S.4" ... > source(.trPaths[5], echo=TRUE, max.deparse.length=150) > str(temp) 'data.frame': 140 obs. of 9 variables: $ Row.names :Class 'AsIs' chr [1:140] "1415743_at" "1415887_at" "1416332_at" "1416340_a_at" ... $ R.S.adj.pvalue: num 4.93e-02 2.83e-02 1.07e-02 2.68e-02 3.92e-05 ... $ R.S.Tau : num 21.6 23.6 26.6 29.7 18.8 20 24.6 27.9 23.9 22.7 ... $ R.S.xpiek : num 6.74 17.46 15.81 15.39 14.73 ... $ R.S.xdal : num 16.94 1.76 22.8 1.12 5.41 ... $ R.S.p1 : num 0.0004 0.0001 0.0467 0.0024 0 ... $ R.S.p2 : num 0.0039 0 0.002 0.019 0.0001 0.0035 0.0351 0.0126 0.0028 0.0192 ... $ R.S.p3 : num 0.0178 0.0004 0.0101 0.0312 0.0012 0.022 0.0008 0.0151 0.0048 0.0317 ... $ V1 : num 3.96 -0.94 1.04 1.94 -2.53 ... >
Karl Brand <k.brand at erasmusmc.nl> Department of Genetics Erasmus MC Dr Molewaterplein 50 3015 GE Rotterdam P +31 (0)10 704 3211 | F +31 (0)10 704 4743 | M +31 (0)642 777 268