DESeq2-arguments imply differing number of rows:

Hi all, I am attempting to use DESeq2 for data analysis. I got the error below and I am unsure how to resolve this.

file.list <- list.files( path = "./", pattern = "*$")
counts.files <- lapply(file.list, read.table, skip = 3)
counts <- sapply( counts.files, function(x) x[ ,2] ) )
colnames(counts) <- file.list
row.names(counts) <- counts.files[[1]]$V1
condition <- c(rep("Kdm5_present",5), rep("Kdm5_absent",5))
sampleTable <- data.frame(sampleName = file.list, condition = condition)
Error in data.frame(sampleName = file.list, condition = condition) :
arguments imply differing number of rows: 4, 10

Hi @er48,
Welcome to the RStudio Community Forum.
You haven't provided us with any of your data to test, but it looks like you have processed 4 files and are then trying to add a column condition which has 10 values - hence the mismatch since all columns in a dataframe must be the same length. Try leaving out condition and check that the sampleTable dataframe looks as you expected (single column with correct number of rows?). This may then guide you how to adjust the condition vector to add as a column. Also, print the intermediate objects (file.list, counts.files, etc) to check their contents are as expected.

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