Issue with edgeR
2
0
Entering edit mode
t3h096 • 0
@t3h096-10904
Last seen 8.5 years ago

When I try to run this portion of code i receive the error:

> colnames( counts ) <- paste(c(rep("Gene.ID",1),rep("Reads.Count",1)),sep=",") # sample names
Error in `colnames<-`(`*tmp*`, value = c("Gene.ID", "Reads.Count")) : 
  'names' attribute [2] must be the same length as the vector [0]

the files in question are csv's and they have 2 columns. 

Thank you for your help.

software error edger columns • 965 views
ADD COMMENT
1
Entering edit mode
@james-w-macdonald-5106
Last seen 7 hours ago
United States

This question has nothing to do with edgeR, but is instead a general R question. And you don't give enough information for anybody to help you. But if I rummage around in R, I get this:

> counts <- data.frame()
> colnames(counts) <- paste(c(rep("Gene.ID",1),rep("Reads.Count",1)),sep=",")
Error in `colnames<-`(`*tmp*`, value = c("Gene.ID", "Reads.Count")) :
  'names' attribute [2] must be the same length as the vector [0]

Which makes me think that you have somehow instantiated an empty data.frame and are now trying to put column names on it. You need to actually have a two-column data.frame first! Note as well that

colnames(counts) <- paste(c(rep("Gene.ID",1),rep("Reads.Count",1)),sep=",")

is a more, um, verbose way of doing

colnames(counts) <- c("Gene.ID","Reads.Count")
ADD COMMENT
0
Entering edit mode
@gordon-smyth
Last seen 2 hours ago
WEHI, Melbourne, Australia

If you have two-column files containing counts, perhaps you should be using the readDGE() function to read them into R and edgeR?

ADD COMMENT

Login before adding your answer.

Traffic: 648 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6