You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: QtSLiM/help/EidosHelpClasses.html
+2Lines changed: 2 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -43,6 +43,8 @@
43
43
<pclass="p3">nrow => (integer$)</p>
44
44
<pclass="p4">The number of rows in the <spanclass="s1">DataFrame</span> (i.e., the number of elements in a column).<spanclass="Apple-converted-space"></span>This will be the same for every column, by definition.</p>
<pclass="p4">Returns a matrix representation of the <spanclass="s1">DataFrame</span>.<spanclass="Apple-converted-space"></span>The matrix will have the same type as the elements of the <spanclass="s1">DataFrame</span>; if the <spanclass="s1">DataFrame</span> contains more than one type of element, an error will be raised.<spanclass="Apple-converted-space"></span>The order of the columns of the <spanclass="s1">DataFrame</span> will be preserved.<spanclass="Apple-converted-space"></span>This method is useful, for example, if you wish to read in a text file as a matrix; you can use <spanclass="s1">readCSV()</span> to read the file as a <spanclass="s1">DataFrame</span>, and then convert it to a matrix with <spanclass="s1">asMatrix()</span>.</p>
<pclass="p4">Adds all of the columns contained by <spanclass="s1">source</span> (which must be a <spanclass="s1">Dictionary</span> or a subclass of <spanclass="s1">Dictionary</span> such as <spanclass="s1">DataFrame</span>) to the receiver.<spanclass="Apple-converted-space"></span>This method makes the target <spanclass="s1">DataFrame</span> wider, by adding new columns.<spanclass="Apple-converted-space"></span>If <spanclass="s1">source</span> contains a column name that is already defined in the target, an error will result.<spanclass="Apple-converted-space"></span>As always for <spanclass="s1">DataFrame</span>, the columns of the resulting <spanclass="s1">DataFrame</span> must all be the same length.</p>
48
50
<pclass="p4">The <spanclass="s1">source</span> parameter may be a non-singleton vector containing multiple <spanclass="s1">Dictionary</span> objects, and additional <spanclass="s1">Dictionary</span> vectors may be supplied (thus the ellipsis in the signature).<spanclass="Apple-converted-space"></span>Each <spanclass="s1">Dictionary</span> supplied will be added to the target, in the order supplied.</p>
Copy file name to clipboardExpand all lines: VERSIONS
+1Lines changed: 1 addition & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -18,6 +18,7 @@ development head (in the master branch):
18
18
improve memory usage for Individual, down to 192 bytes from 232 bytes, by compactifying the color information for SLiMgui and rearranging ivars to minimize wasted space
19
19
the color property on Individual no longer guarantees that the value read equals the value set; when a color is set, it is now converted to RGB, so named colors do not round-trip
20
20
add a meanParentAge property, to make calculating generation length simpler; unavailable in WF models (like age), 0 for parentless individuals
21
+
add DataFrame asMatrix() method to convert a DataFrame into a matrix, if all columns are the same type/class
EIDOS_TERMINATION << "ERROR (EidosDataFrame::ExecuteMethod_asMatrix): asMatrix() requires that every column of the target DataFrame is the same type (" << type_template->Type() << " != " << symbols_iter.second->Type() << ")." << EidosTerminate(nullptr);
EIDOS_TERMINATION << "ERROR (EidosDataFrame::ExecuteMethod_asMatrix): asMatrix() requires that every object element in the target DataFrame is the same class (" << class_template->ClassName() << " != " << class_column->ClassName() << ")." << EidosTerminate(nullptr);
406
+
}
407
+
}
408
+
}
409
+
410
+
// Create the matrix; for now we use a slow implementation that is type-agnostic and does not resize to fit first, probably this is unlikely to be a bottleneck
0 commit comments