-
Notifications
You must be signed in to change notification settings - Fork 68
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support .rx[row, col]
indexing for matrices and data frames
#1086
Comments
matrix.rx[]
indexing.rx[row, col]
indexing for matrices and data frames
Yes. I once considered it but the subseting operator
Python does not allow it. Adding a named argument to a I checked this again and PEP-0472 could have resolved this but was ultimately rejected (https://peps.python.org/pep-0472/). Alternative methods propose a dictionary as an additional index to have named parameters. This could be a good solution. |
It would be nice to support
matrix_or_df.rx[1, 2]
as an alternative tomatrix_or_df.rx(1, 2)
. This would also let you assign to a matrix or data frame usingmatrix_or_df.rx[1, 2] = ...
.As an extension, it would also be nice to support
matrix_or_df.rx[:, 2]
as an alternative tomatrix_or_df.rx(True, 2)
, andmatrix_or_df.rx[2, :]
as an alternative tomatrix_or_df.rx(2, True)
. Note that this would meanmatrix_or_df.rx[2, :]
would behave differently frommatrix_or_df.rx[2]
, which is unexpected for Python but makes sense when you consider thatmatrix_or_df[2,]
andmatrix_or_df[2]
are different in R.The text was updated successfully, but these errors were encountered: