diff center_scale.R @ 1:a96cc346819c draft

planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/gsc_center_scale commit 7865eb7eb9d862e9967fe519d28df705d973fbaf
author artbio
date Fri, 12 Jul 2019 11:44:50 -0400
parents bcbd7179d8ec
children 163befe5f05b
line wrap: on
line diff
--- a/center_scale.R	Thu Jul 11 13:31:20 2019 -0400
+++ b/center_scale.R	Fri Jul 12 11:44:50 2019 -0400
@@ -43,7 +43,7 @@
     transfo <- scale(
         t(df),
         center=center,
-        scale=center
+        scale=scale
         )
     return(as.data.frame(t(transfo)))
 }
@@ -70,12 +70,14 @@
     data.transformed <- data.frame(row.names=rownames(data), stringsAsFactors=FALSE)
     for (group in levels(data.factor$level)){
         subcells <- as.data.frame(subset(data.factor, level==group, select=cellid))
-        subdata <- as.data.frame(subset(data, select=subcells$cellid))
-        subdata.transformed <- transform(subdata, center=opt$center, scale=opt$scale)
+        subdata <- as.data.frame(subset(data, select=as.vector(subcells$cellid)))
+        subdata.transformed <- transform(subdata, center=as.logical(opt$center),
+                                                  scale=as.logical(opt$scale))
         data.transformed <- cbind(data.transformed, subdata.transformed)
     }
 } else {
-    data.transformed <- transform(data, center=opt$center, scale=opt$scale)
+    data.transformed <- transform(data, center=as.logical(opt$center),
+                                        scale=as.logical(opt$scale))
 }