[Seqinr-commits] r1620 - pkg/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Fri Jul 17 23:44:22 CEST 2009


Author: lobry
Date: 2009-07-17 23:44:21 +0200 (Fri, 17 Jul 2009)
New Revision: 1620

Added:
   pkg/R/swap.R
Log:
new function

Added: pkg/R/swap.R
===================================================================
--- pkg/R/swap.R	                        (rev 0)
+++ pkg/R/swap.R	2009-07-17 21:44:21 UTC (rev 1620)
@@ -0,0 +1,9 @@
+swap <- function(x, y){
+  x.sub <- substitute(x)
+  y.sub <- substitute(y)
+  x.val <- x
+  e <- parent.frame()
+  do.call("<-", list(x.sub, y.sub), envir = e)
+  do.call("<-", list(y.sub, x.val), envir = e)
+}
+



More information about the Seqinr-commits mailing list