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.