[rkward-cvs] SF.net SVN: rkward:[3359] trunk/rkward/rkward
tfry at users.sourceforge.net
tfry at users.sourceforge.net
Wed Jan 12 11:46:19 UTC 2011
Revision: 3359
http://rkward.svn.sourceforge.net/rkward/?rev=3359&view=rev
Author: tfry
Date: 2011-01-12 11:46:19 +0000 (Wed, 12 Jan 2011)
Log Message:
-----------
Show one empty row for newly created data.frames
Modified Paths:
--------------
trunk/rkward/rkward/dataeditor/rkvareditmodel.cpp
trunk/rkward/rkward/rbackend/rpackages/rkward/R/internal.R
Modified: trunk/rkward/rkward/dataeditor/rkvareditmodel.cpp
===================================================================
--- trunk/rkward/rkward/dataeditor/rkvareditmodel.cpp 2011-01-12 09:59:34 UTC (rev 3358)
+++ trunk/rkward/rkward/dataeditor/rkvareditmodel.cpp 2011-01-12 11:46:19 UTC (rev 3359)
@@ -70,7 +70,7 @@
beginInsertColumns (QModelIndex (), index, index);
if (meta_model) meta_model->beginAddDataObject (index);
- if (object->isPending ()) object->setLength (trueRows ()); // probably we just created it ourselves
+ if (object->isPending () && (!object->getLength ())) object->setLength (trueRows ()); // probably we just created it ourselves
listenForObject (object);
objects.insert (index, object);
if (meta_model) meta_model->endAddDataObject ();
@@ -756,6 +756,8 @@
for (int i = 0; i < initial_cols; ++i) {
RObject* child = df->createPendingChild (df->validizeName (QString ()), -1, false, false);
RK_ASSERT (child->isVariable ());
+ // let's start with one (empty) row, to avoid confusion
+ static_cast<RKVariable*> (child)->setLength (1);
}
init (df);
Modified: trunk/rkward/rkward/rbackend/rpackages/rkward/R/internal.R
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkward/R/internal.R 2011-01-12 09:59:34 UTC (rev 3358)
+++ trunk/rkward/rkward/rbackend/rpackages/rkward/R/internal.R 2011-01-12 11:46:19 UTC (rev 3359)
@@ -41,7 +41,7 @@
# function below is only needed to ensure a nice ordering of the columns. Simply adding a new column would be much easier than this.
".rk.data.frame.insert.column" <- function (x, label, index=0) {
- column <- as.numeric (rep (NA, times=dim (x)[2]))
+ column <- rep (as.numeric (NA), times=dim (x)[1])
if ((index == 0) || (index > dim (x)[2])) { # insert column at end
eval (substitute (x[[label]] <<- column))
} else {
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