Browse code

Replace match.fun with get.

I got errors using match.fun(functionName) when functionName was not
exported. However, get(functionName) seems to work

git-svn-id: file:///home/git/hedgehog.fhcrc.org/bioconductor/trunk/madman/Rpacks/crlmm@49147 bc3139a8-67e5-0310-9ffc-ced21a209358

Rob Scharp authored on 30/08/2010 19:41:22
Showing2 changed files

... ...
@@ -1552,7 +1552,8 @@ genotypeSummary <- function(object,
1552 1552
 		       X.SNP="summarizeSnps",
1553 1553
 		       X.NP="summarizeNps")
1554 1554
 	}
1555
-	FUN <- summaryFxn(type[[1]])
1555
+	myf <- summaryFxn(type[[1]])
1556
+	FUN <- get(myf)
1556 1557
 	if(is.lds){
1557 1558
 		index.list <- splitIndicesByLength(marker.index, ocProbesets())
1558 1559
 		ocLapply(seq(along=index.list),
... ...
@@ -1565,8 +1566,7 @@ genotypeSummary <- function(object,
1565 1566
 			 is.lds=is.lds,
1566 1567
 			 CHR.X=CHR.X,
1567 1568
 			 neededPkgs="crlmm")
1568
-	} else {
1569
-		FUN <- match.fun(FUN)
1569
+	} else{
1570 1570
 		object <- FUN(strata=1,
1571 1571
 			      index.list=list(marker.index),
1572 1572
 			      object=object,
... ...
@@ -1860,7 +1860,8 @@ estimateCnParameters <- function(object,
1860 1860
 		       X.SNP="fit.lm3",
1861 1861
 		       X.NP="fit.lm4")
1862 1862
 	}
1863
-	FUN <- lmFxn(type[[1]])
1863
+	myfun <- lmFxn(type[[1]])
1864
+	FUN <- get(myfun)
1864 1865
 	if(is.lds){
1865 1866
 		index.list <- splitIndicesByLength(marker.index, ocProbesets())
1866 1867
 		ocLapply(seq(along=index.list),
... ...
@@ -1882,7 +1883,7 @@ estimateCnParameters <- function(object,
1882 1883
 			 CHR.X=CHR.X,
1883 1884
 			 neededPkgs="crlmm")
1884 1885
 	} else {
1885
-		FUN <- match.fun(FUN)
1886
+		##FUN <- match.fun(FUN)
1886 1887
 		object <- FUN(strata=1,
1887 1888
 			      index.list=list(marker.index),
1888 1889
 			      marker.index=marker.index,
... ...
@@ -2,7 +2,7 @@
2 2
 THISPKG <- "crlmm"
3 3
 
4 4
 .onLoad <- function(libname, pkgname) {
5
-  require("methods")
5
+	require("methods")
6 6
 }
7 7
 
8 8
 .onAttach <- function(libname, pkgname) {