jonkeane commented on a change in pull request #8579:
URL: https://github.com/apache/arrow/pull/8579#discussion_r519488908



##########
File path: r/R/table.R
##########
@@ -261,28 +261,38 @@ names.Table <- function(x) x$ColumnNames()
 `[[<-.Table` <- function(x, i, value) {
   if (is.null(value)) {
     if (is.character(i)) {
-      i <- match(i, names(x)) - 1L
+      i <- match(i, names(x))
     }
-    x <- x$RemoveColumn(i)
+    x <- x$RemoveColumn(i - 1L)
   } else {
     if (!is.character(i)) {
       # get or create a/the column name
-      if (i <= ncol(x)) {
-        i <- names(x)[[i]]
+      if (i <= x$num_columns) {
+        i <- names(x)[i]
       } else {
         i <- as.character(i)
       }
     }
 
+    # auto-magic recycling

Review comment:
       TIL about `vctrs::vec_recycle` that's really nice. 




----------------------------------------------------------------
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]


Reply via email to