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
The proposal here is to improve API consistency between the 2D classes Matrix and DataFrame by:
deprecating the .nrows() function in DataFrame in favor of adding .nrow() and .rows()
introduce the .ncol() and .cols() functions to DataFrame that map to Vector's size() and length() functions.
However, another interesting proposal would be to remove the size attribute access information provided by .cols() and .rows() for the Matrix class and introduce .Rows(first, last) and .Cols(first, last) that would provide submatrix views.
APIs
For the Matrix class, the following member functions are defined for dimensional information:
Member
Description
.nrow(),.rows()
number of rows in a Matrix
.ncol(),.cols()
number of columns in a Matrix
.size(),.length()
number of items in a Matrix, Vector
Meanwhile, over in DataFrame land, the member functions are defined a bit differently:
Member
Description
.nrows()
number of rows in a DataFrame
.size(),.length()
number of columns in a DataFrame
The break in consistency regarding the nrow() and ncol() within DataFrame is problematic as it breaks with those accessor functions available in base R.
data.frame and length() note
Note, 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.
df=data.frame(a=1:3, b=3:1)
length(df)
# 2
The text was updated successfully, but these errors were encountered:
The proposal here is to improve API consistency between the 2D classes
Matrix
andDataFrame
by:.nrows()
function inDataFrame
in favor of adding.nrow()
and.rows()
.ncol()
and.cols()
functions toDataFrame
that map toVector
'ssize()
andlength()
functions.However, another interesting proposal would be to remove the size attribute access information provided by
.cols()
and.rows()
for theMatrix
class and introduce.Rows(first, last)
and.Cols(first, last)
that would provide submatrix views.APIs
For the
Matrix
class, the following member functions are defined for dimensional information:.nrow()
,.rows()
Matrix
.ncol()
,.cols()
Matrix
.size()
,.length()
Matrix
,Vector
Meanwhile, over in
DataFrame
land, the member functions are defined a bit differently:.nrows()
DataFrame
.size()
,.length()
DataFrame
The break in consistency regarding the
nrow()
andncol()
withinDataFrame
is problematic as it breaks with those accessor functions available in base R.data.frame
andlength()
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.The text was updated successfully, but these errors were encountered: