jonkeane commented on a change in pull request #8579:
URL: https://github.com/apache/arrow/pull/8579#discussion_r520602805
##########
File path: r/R/table.R
##########
@@ -254,6 +257,68 @@ names.Table <- function(x) x$ColumnNames()
#' @export
`[[.Table` <- `[[.RecordBatch`
+#' @export
+`[[<-.Table` <- function(x, i, value) {
+ if (!is.character(i) & !is.numeric(i)) {
+ stop("'i' must be character or numeric, not ", class(i), call. = FALSE)
+ } else if (is.na(i)) {
+ # Catch if a NA_character or NA_integer is passed. These are caught
elsewhere
+ # in cpp (i.e. _arrow_RecordBatch__column_name)
+ # TODO: figure out if catching in cpp like ^^^ is preferred
Review comment:
It's a mixture, for `NA_integer_` and `NA_real_` the error is the
previous "missing value where TRUE/FALSE needed" with `NA_character_` though it
removes/creates/replaced a column with the name ``NA``. So I would vote to keep
the special casing for now and try catching in cpp or with a helper function we
can use across `[[` and `[` methods later.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]