Error in strsplit(TCGABarcode, split = "-") : non-character argument
2
0
Entering edit mode
5.4 years ago

hi

I use TCGA Assembler2 for data integration.

when run below codes this error occurred: Error in strsplit(TCGABarcode, split = "-") : non-character argument

how solve this error?

TNX

inputDataList   <- vector("list",   5)
inputDataList[[1]]  <- list(Des = GeneExpData$Des, Data = GeneExpData$Data, dataType = "geneExp")
inputDataList[[2]]  <- list(Des = Methylation450_TSS1500_DHS$Des, Data = Methylation450_TSS1500_DHS$Data,   dataType = "methylation")
inputDataList[[3]]  <- list(Des = GeneLevelCNA$Des, Data = GeneLevelCNA$Data, dataType = "copyNumber")
inputDataList[[4]]  <- list(Des = RPPAData$Des, Data = RPPAData$Data,   dataType    = "protein_RPPA")
inputDataList[[5]]  <- list(Des = miRNASeqData$Des, Data = miRNASeqData$Data, dataType = "miRNAExp")
MergedData <- CombineMultiPlatformData(inputDataList = inputDataList)
R • 5.5k views
ADD COMMENT
0
Entering edit mode

this is a TCGABarcode sample: TCGA-A6-3807-01A.22

ADD REPLY
0
Entering edit mode

Do not add an answer unless you're answering the top level question. I've moved this to a comment now, but use Add Comment or Add Reply at the appropriate spot in the future.

ADD REPLY
0
Entering edit mode

class(TCGABarcode) ?

ADD REPLY
0
Entering edit mode
> class(TCGABarcode)

Error: object 'TCGABarcode' not found
ADD REPLY
0
Entering edit mode

ATPoint is asking if the sample you provided above is a string in R or you just typed in the object name and it rendered a string representation of a more complex object. class(xyz) shows what type of object xyz is.

Please understand the concept behind these clarifying questions, copy-pasting code verbatim never works.

From your error, it seems obvious that your environment when you ran the command in the question strsplit(TCGABarcode, split = "-") is not the same as your environment now, as the object TCGABarcode definitely existed in that environment while it doesn't exist now.

ADD REPLY
0
Entering edit mode

I'm sorry I am very amateur and recently I work with R I'm confused now Now I am trying to solve the problem, if not resolved will come back again. thank you for your attention

ADD REPLY
1
Entering edit mode
5.4 years ago
zx8754 12k

We are passing some factors to strsplit, to reproduce:

strsplit("my-factor-text", split = "-")
# [[1]]
# [1] "my"     "factor" "text" 

strsplit(factor("my-factor-text"), split = "-")
# Error in strsplit(factor("my-factor-text"), split = "-") : 
#   non-character argument

I am guessing you are using the TCGA-Assembler-2 from GitHub. When creating the input object - inputDataList, your list contains factors, not character class.

ADD COMMENT
0
Entering edit mode

yes. I am using the TCGA-Assembler-2 .

how solve this problem?

TNX in advance

ADD REPLY
0
Entering edit mode
  1. Use as.character() to convert an object from factor to character (string)
  2. Please use professional language and avoid jargon such as "TNX". Use the proper "Thanks" instead.
ADD REPLY
0
Entering edit mode
5.4 years ago
ATpoint 85k

TCGABarcode is not a split-able character and probably a list if I interpret this code at the bottom correctly. Can you show the content of this variable?

Splitting a list:

tmp <- as.list(c("hi-ho", "foo-bar"))
sapply(tmp, function(x) strsplit(x, split="-"))
ADD COMMENT

Login before adding your answer.

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