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

Thiago Maia maia at adylnet.com.br
Mon Mar 11 14:43:27 CET 2013


Ops... sorry I just found (after many hours), it was so simple, how could  
take that long.. heheh

nchar(as.character(seq2[i]))

thanks

Thiago Maia
> 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
>
>
> --
>
> _______________________________________________
> Bioconductor mailing list
> Bioconductor at r-project.org
> https://stat.ethz.ch/mailman/listinfo/bioconductor
> Search the archives:  
> http://news.gmane.org/gmane.science.biology.informatics.conductor


--



More information about the Bioconductor mailing list