[BioC] no method for coercing this S4 class to a vector

Thiago Maia maia at adylnet.com.br
Mon Mar 11 14:16:58 CET 2013


Hello

       - Sorry if this message appear twice, before I sent from the wrong  
e-mail address(not registered)

        I trying to make a function in R but I couldnt figure out whats
happening.

        I loadded a fasta file.
        seq2 <- readDNAStringSet("c:/teste/testfile.txt","fasta")

        I would like to get the length.
        If I execute directly all works

        > nchar(seq2[1])
          Test_4489
                 90

        But if I create a function
        function (N) {
           nchar(seq2[1])
        }

        when I execute
        > fn1(1)
        Error in nchar(seq2[1]) :
        no method for coercing this S4 class to a vector

        I tried things like as.vector(nchar(seq2[1])) but got the same
message.

        Does anybody have a suggestion what I have to do or read.

thanks a lot

Thiago Maia


--



More information about the Bioconductor mailing list