xyzzz
xyzzz

Reputation: 31

Duplicate 'row.names' are not allowed while importing data from database using R

While importing data from a database(ArrayExpress) using this -

anno_AE <- getAE("Accessionid", path = raw_data_dir, type = "raw")
sdrf_location <- file.path(raw_data_dir, "Accessionid.sdrf.txt")
SDRF <- read.delim(sdrf_location)

After this-

rownames(SDRF) <- SDRF$Array.Data.File

Getting error like this-

Error in `.rowNamesDF<-`(x, value = value) : 
  duplicate 'row.names' are not allowed
In addition: Warning message:
non-unique values when setting 'row.names':

how to solve this issue?

Upvotes: 0

Views: 110

Answers (1)

Ronak Shah
Ronak Shah

Reputation: 388817

You might have duplicate values in SDRF$Array.Data.File. Try using make.unique to make the values unique.

rownames(SDRF) <- make.unique(SDRF$Array.Data.File)

Upvotes: 1

Related Questions