[BioC] Error with unique

Erik Wright eswright at wisc.edu
Tue Apr 6 04:23:11 CEST 2010


Hi Sean,

Here is a simple function that creates the problem:
doUnique <- function(myDNAStringSet) {
	myDNAStringSet <- unique(myDNAStringSet)
}

Here is the output in the R Console:
> doUnique(myDNAStringSet)
Error in unique.default(myDNAStringSet) : 
  unique() applies only to vectors
> sessionInfo()
R version 2.10.1 (2009-12-14) 
i386-apple-darwin9.8.0 

locale:
[1] en_US.UTF-8/en_US.UTF-8/C/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods  
[7] base     

other attached packages:
[1] GoneFISHing_1.0.5  RSQLite_0.8-3      DBI_0.2-5         
[4] Biostrings_2.14.12 IRanges_1.4.11    

loaded via a namespace (and not attached):
[1] Biobase_2.6.1

Thanks again!,
Erik


On Apr 5, 2010, at 8:55 PM, Sean Davis wrote:

> On Mon, Apr 5, 2010 at 9:51 PM, Erik Wright <eswright at wisc.edu> wrote:
>> Hi all,
>> 
>> I am using the unique(x) function with a DNAStringSet in one of my own functions.  Recently my function has started returning an error, and I am not sure what changed.  The same line of code works fine in the R Console, just not in my function.  I am using the function as:
>> 
>> myDNAStringSet <- unique(myDNAStringSet)
>> 
>> When I run my function the error returned is:
>> 
>> Error in unique.default(myDNAStringSet) :
>>  unique() applies only to vectors
>> 
>> I am guessing that the R is trying to apply the unique function in the base package to the DNAStringSet rather than using the unique function in the Biostrings package.  Is there a solution to this?
>> 
> 
> Hi, Erik.  A reproducible example and sessionInfo() would be helpful.
> 
> Sean



More information about the Bioconductor mailing list