Question: Error dataframe in data.frame: replacement has 1 row, data has 65
0
8 days ago by
Diana10
Diana10 wrote:

Hi all,

When running the following code:

    library(qusage)
library(nlme)
gmtfile <- file.path("hallmarkgeneSets.gmt")
# define log2 matrix
eset <- top500logcpm
fixedeffects <- ~SVZstatus
contrast = "SVZ - nonSVZ"
qusage.result.random<-qgen(eset,Design,
fixed=fixedeffects,
contrast.factor=fixedeffects,
contrast=contrast,
geneSets=hallmarkgeneSets,
random=~1|Subject,
design.sampleid="Name")


I get this error:

## All samples present in design
##  Samples in Design and Expression MatchNumber of random effect replicates are low.  The adjusted residuals will be used for VIF  estimation
## Running row by row modeling.
## Percent Complete: **Error in \$<-.data.frame(*tmp*, "y", value = list(S10a = 4.9309065104826,  :
replacement has 1 row, data has 65**


My design and dataframe (=eset) both have the same 65 samples. This is a part of my logcpm matrix (first 6 genes and first 8 samples to give an impression):

        S1a      S1b       S1c       S2a      S2b       S2c      S3a      S3b
AARS    4.683279 4.220741  5.658710  6.402773 5.466651  6.304351 3.274032 4.806271
PARP1   7.444794 7.207082  7.851796  8.053652 7.466552  8.003361 6.382111 6.877725
ALAS1   3.232928 3.646757  3.865328  5.685175 5.274802  5.636583 2.702698 3.196725
ALDH3B1 5.401109 4.707025  4.766474  4.574564 4.271840  4.503090 5.609926 5.144258
ALDOA   9.025833 8.372518 10.352643 10.062408 9.749903 10.454209 6.905216 7.993137
APOD    7.572512 6.608217  7.065483  7.426966 5.460514  6.759074 4.874352 5.978170


This is part of my design (6 out of 65 samples)

  Name SVZstatus Subject
1  S1a       SVZ       1
2  S1b       SVZ       1
3  S1c       SVZ       1
4  S2a       SVZ       2
5  S2b       SVZ       2
6  S2c       SVZ       2


I don't understand the given error, so I don't know how I should fix my code. When performing a similar analysis without a random factor and fixed effect, everything works fine (but that's no way to go since I have to adjust for my within subject correlation of samples). Thanks for your help!

qusage weird r error • 39 views