0

the following commands runs smmooth:

csvfile <- file.path("C:/Users/Jbhanda/Desktop/deseq.csv")
coldata <- read.csv(csvfile, row.names=1, stringsAsFactors=FALSE)
coldata

then I run another command just after that:

coldata <- coldata[1:2,]
coldata$names <- coldata$Run
coldata$files <- file.path(dir, "quants", coldata$names, "quant.sf.gz")

It gives the following error:

Error in $<-.data.frame(*tmp*, files, value = character(0)) : replacement has 0 rows, data has 2

I want to know what is wrong in the data frame and how can i rectify the command

Tung
  • 26,371
  • 7
  • 91
  • 115
  • Welcome to Stack Overflow! Could you make your problem reproducible by sharing a sample of your data so others can help (please do not use `str()`, `head()` or screenshot)? You can use the [`reprex`](https://reprex.tidyverse.org/articles/articles/magic-reprex.html) and [`datapasta`](https://cran.r-project.org/web/packages/datapasta/vignettes/how-to-datapasta.html) packages to assist you with that. See also [Help me Help you](https://speakerdeck.com/jennybc/reprex-help-me-help-you?slide=5) & [How to make a great R reproducible example?](https://stackoverflow.com/q/5963269) – Tung Feb 10 '23 at 06:20
  • `file.path(dir, "quants", coldata$names, "quant.sf.gz")` probably produces zero results. Run that code independently in the console and see the result. For better help please provide reproducible a example. – fahmy Feb 10 '23 at 06:48

0 Answers0