[Picante-commits] r76 - branches/gsoc/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu May 29 20:15:56 CEST 2008


Author: mrhelmus
Date: 2008-05-29 20:15:56 +0200 (Thu, 29 May 2008)
New Revision: 76

Modified:
   branches/gsoc/R/phylodiversity.R
Log:
1. Working code for PSR
2. Fixed bug: PSV did not output data.frame and now it does

Modified: branches/gsoc/R/phylodiversity.R
===================================================================
--- branches/gsoc/R/phylodiversity.R	2008-05-28 23:16:47 UTC (rev 75)
+++ branches/gsoc/R/phylodiversity.R	2008-05-29 18:15:56 UTC (rev 76)
@@ -170,7 +170,7 @@
 }
 
 if(compute.var==FALSE) {
-  return(PSVout)
+  return(data.frame(PSVout))
 } else {
 
   PSVvar<-NULL
@@ -208,6 +208,19 @@
   {
     PSVout[g,3]<-PSVvar[PSVout[g,2]-1,2]
   }
-  return(PSVout)
+  return(data.frame(PSVout))
   }
 }
+
+PSRcalc <- function(samp,tree,compute.var=TRUE){
+  PSVout<-PSVcalc(samp,tree,compute.var)
+  PSRout<-cbind(PSVout[,1]*PSVout[,2],PSVout[,2])
+  if(compute.var!=TRUE) {
+    colnames(PSRout)<-c("PSR","SR")
+    return(data.frame(PSRout))
+  } else {
+    PSRout<-cbind(PSRout,PSVout[,3]*(PSVout[,2])^2)       
+    colnames(PSRout)<-c("PSR","SR","vars")
+    return(data.frame(PSRout))
+  }
+}
\ No newline at end of file



More information about the Picante-commits mailing list