[rkward-cvs] SF.net SVN: rkward:[3430] trunk/rkward/rkward/rbackend/rpackages/rkward/R/ internal.R

tfry at users.sourceforge.net tfry at users.sourceforge.net
Wed Feb 9 10:55:17 UTC 2011


Revision: 3430
          http://rkward.svn.sourceforge.net/rkward/?rev=3430&view=rev
Author:   tfry
Date:     2011-02-09 10:55:16 +0000 (Wed, 09 Feb 2011)

Log Message:
-----------
Do not drop data.frame class when only one column is left.

Modified Paths:
--------------
    trunk/rkward/rkward/rbackend/rpackages/rkward/R/internal.R

Modified: trunk/rkward/rkward/rbackend/rpackages/rkward/R/internal.R
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkward/R/internal.R	2011-02-08 19:35:31 UTC (rev 3429)
+++ trunk/rkward/rkward/rbackend/rpackages/rkward/R/internal.R	2011-02-09 10:55:16 UTC (rev 3430)
@@ -32,11 +32,12 @@
 	for (i in 1:dim (x)[2]) {
 		attriblist[[names (x)[i]]] <- attributes (x[[i]])
 	}
-	eval (substitute (x <<- x[-index,]))
-	eval (substitute (row.names (x) <<- c (1:dim(x)[1])))
-	for (i in 1:dim (x)[2]) {
-		eval (substitute (attributes (x[[i]]) <<- attriblist[[names (x)[i]]]))
+	newx <- x[-index, , drop=FALSE]
+	row.names (newx) <- c (1:dim(newx)[1])
+	for (i in 1:dim (newx)[2]) {
+		attributes (newx[[i]]) <- attriblist[[names (newx)[i]]]
 	}
+	eval (substitute (x <<- newx))
 }
 
 # function below is only needed to ensure a nice ordering of the columns. Simply adding a new column would be much easier than this.


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the rkward-tracker mailing list