0

i have a problem with running my code in an R function.

function (fasta_soubor, prah = 10) 
{
x <- readDNAStringSet(fasta_soubor)
if (length(grep("N", x, ignore.case = T)) != 0) {
    x <- x[-grep("N", x, ignore.case = T)]
}
data <- as.data.frame(table(x))
data <- data[order(data$Freq, decreasing = TRUE), ]
pocet <- sum(data[, 2] > prah)
kond <- DNAStringSet(as.vector.factor(data[1:pocet, 1]))
pocty <- data[1:pocet, 2]
names(kond) <- paste(pocty, "_sekvenci", sep = "")
nazev <- paste(strsplit(fasta_soubor, "\\.")[[1]][1], "_condensed.fasta", 
    sep = "")
writeXStringSet(kond, nazev)
return(kond)
}

It returns an error at:

data <- as.data.frame(table(x))

Error message:

Error in .duplicated.XRawList(x, incomparables = incomparables, ...) : unused argument (nmax = NA)

But when i try to run the same code line by line with the same parameters, it runs smoothly. In debugger the as.data.frame(table(x)) command has identical x parameter as in the script, but it just does not work.

PKumar
  • 10,971
  • 6
  • 37
  • 52
  • What is the code supposed to do? – liborm May 21 '17 at 13:48
  • 1
    Can you make your code *minimal* and reproducible, and provide some example data. See this post for help: http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example – Phil May 21 '17 at 13:49

0 Answers0