Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upMirror Matrix Dimensional Member Functions for DataFrame #630
Comments
…-accessors Adds size attribute aliases for DataFrame (closes #630)
The proposal here is to improve API consistency between the 2D classes
MatrixandDataFrameby:.nrows()function inDataFramein favor of adding.nrow()and.rows().ncol()and.cols()functions toDataFramethat map toVector'ssize()andlength()functions.However, another interesting proposal would be to remove the size attribute access information provided by
.cols()and.rows()for theMatrixclass and introduce.Rows(first, last)and.Cols(first, last)that would provide submatrix views.APIs
For the
Matrixclass, the following member functions are defined for dimensional information:.nrow(),.rows()Matrix.ncol(),.cols()Matrix.size(),.length()Matrix,VectorMeanwhile, over in
DataFrameland, the member functions are defined a bit differently:.nrows()DataFrame.size(),.length()DataFrameThe break in consistency regarding the
nrow()andncol()withinDataFrameis problematic as it breaks with those accessor functions available in base R.data.frameandlength()noteNote, there is no need to change the
length()function call since the R equivalent returns the number of columns instead of the amount of elements, e.g.