is.null(pData) | class(pData) == "data.frame" is not TRUE
0
0
Entering edit mode
merden1603 • 0
@49f68473
Last seen 3.3 years ago
Turkey

Hi, I am having problems with R when I am using it to analyze the data from Hisat2-Stringtie as in the article Nature,2016.

pheno_data = read.csv("phenotype_data.csv")
    bg <- ballgown(dataDir = "ballgown", samplePattern = "NP", pData = pheno_data)

When I run this code I get this error:

# Error in ballgown(dataDir = "ballgown", samplePattern = "NP", pData = pheno_data) : 
  first column of pData does not match the names of the folders containing the ballgown data.
In addition: Warning message:
In ballgown(dataDir = "ballgown", samplePattern = "NP", pData = pheno_data) :
  Rows of pData did not seem to be in the same order as the columns of the expression data. Attempting to rearrange pData...

However, when I do this:

pheno_data = read.csv("phenotype_data.csv")
    pheno_data=pheno_data[order(pheno_data$id.state),]
    bg <- ballgown(dataDir = "ballgown", samplePattern = "NP", pData = pheno_data)

I get this error:

   # Error in ballgown(dataDir = "ballgown", samplePattern = "NP", pData = pheno_data) : 
      is.null(pData) | class(pData) == "data.frame" is not TRUE

Can you please tell me what am I doing wrong?

ballgown • 1.2k views
ADD COMMENT
0
Entering edit mode

Are you sure pheno_data is a data.frame?

It was probably a data.frame when you loaded the CSV file with read.csv() but then you subsetted it to reorder its rows. Please be aware that subsetting can sometimes drop the data.frame class and return an atomic vector (e.g. if the data.frame has a single column). To prevent this use drop=FALSE e.g.

pheno_data <- pheno_data[order(pheno_data$id.state), , drop=FALSE]
ADD REPLY

Login before adding your answer.

Traffic: 786 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