Arguments imply differing number of rows: 15, 12

i am stuck with this problem in R code please help me

I am trying to create a miodin project and then read a file to dataframe so when i insert the file to the project folder it shows the following error

arguments imply differing number of rows: 15, 12

Here is my code

library(miodin)
mp <- MiodinProject(
    name = "MyProject",
    author = "lee",
    path ="." )

countTable <- read.table(paste0("data/",'seq.txt'), 
    header = TRUE,
    sep = '\t',
    stringsAsFactors = FALSE
)


sampleTable <- data.frame(

  SampleName = colnames(countTable),
SamplingPoint = paste0('sp',rep(1, 12)),
Treatment = rep(c('LineA', 'LineB'), 6)
    )
assayTable <- data.frame(

SampleName = colnames(countTable),
  DataFile = paste0("data/",'seq.txt'),
  DataColumn = colnames(countTable))


ms <- studyDesignCaseControl(
  studyName = "CaseControlStudy",
  factorName = "Treatment",
  caseName = "LineA",
  controlName = "LineB",
  contrastName = "Treatment",
  numCase = 6,
  numControl = 6,
  sampleTable = sampleTable,
  assayTable = assayTable, 
  assayTableName = "RNAseq"
)
insert(ms, mp)
mshow(ms)

This error message means you're trying to do an operation that requires a vector of the same length, or two tables that require the same number of rows. (for example, if one tried to do an OLS with a dependent variable with 15 observations and an independent var with 12 obs, this error message would occur).

Given the code provided it's hard to tell at which point this error occurred. Ideally, you'd pose this question with a reprex and example-dummy data (FAQ: What's a reproducible example (`reprex`) and how do I create one?).

My best stab at advice would be to run this code line by line to see where this error is thrown, and check to see that the inputs are of the appropriate size.
Looking at the docs here: Miodin User Manual, under "Case Control", it seems the sampleTable and assayTable need to be the same length/same-number-of-rows. Your code seems to show that sampleTable should be 12 rows, but your countTable might have 15.

Again, a reprex would allow folks here to help you diagnose things.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.