[R] function name collision

Seth Falcon sfalcon at fhcrc.org
Tue May 15 00:17:54 CEST 2007


Bobby Prill <rprill at jhu.edu> writes:

> I am using the "graph" package, which has a function called union()  
> that acts on graph objects.  There is also a {base} function called  
> union().  How do I explicitly specify union {graph} instead of the  
> default union {base} ?
>
> union(g1, g2)   evokes the wrong union(), which produces an error.

graph::union()
base::union()

And since functions are first class in R, you can make aliases:

gunion <- graph::union
bunion <- base:union

If you are working interactively, then after loading the graph
package, you should get its version of union.

+ seth

-- 
Seth Falcon | Computational Biology | Fred Hutchinson Cancer Research Center
http://bioconductor.org



More information about the R-help mailing list