|
with_tbl(tbl[] <- 1)
#> # A tibble: 4 × 3
#> a b cd
#> <dbl> <dbl> <dbl>
#> 1 1 1 1
#> 2 1 1 1
#> 3 1 1 1
#> 4 1 1 1
|
|
with_tbl(tbl[] <- 4:1)
#> # A tibble: 4 × 3
#> a b cd
#> <int> <int> <int>
#> 1 4 4 4
#> 2 3 3 3
#> 3 2 2 2
#> 4 1 1 1
|
with_df(df[] <- 3:1)
#> a b cd
#> 1 3 2 1
#> 2 2 1 3
#> 3 1 3 2
#> 4 3 2 1
|
with_tbl(tbl[] <- 3:1)
#> Error in `[<-`:
#> ! Assigned data `3:1` must
#> be compatible with existing data.
#> ✖ Existing data has 4 rows.
#> ✖ Assigned data has 3 rows.
#> ℹ Only vectors of size 1 are
#> recycled.
#> Caused by error in `vectbl_recycle_rhs_rows()` at tibble/R/subassign-backend.R:35:5:
#> ! Can't recycle input of size 3 to size 4.
|
with_df(df[] <- 5:1)
#> Error in `[<-.data.frame`(`*tmp*`, , value = 5:1): replacement has 5 items, need 12
|
with_tbl(tbl[] <- 5:1)
#> Error in `[<-`:
#> ! Assigned data `5:1` must
#> be compatible with existing data.
#> ✖ Existing data has 4 rows.
#> ✖ Assigned data has 5 rows.
#> ℹ Only vectors of size 1 are
#> recycled.
#> Caused by error in `vectbl_recycle_rhs_rows()` at tibble/R/subassign-backend.R:35:5:
#> ! Can't recycle input of size 5 to size 4.
|
with_df(df[] <- data.frame(1, "x"))
#> a b cd
#> 1 1 x 1
#> 2 1 x 1
#> 3 1 x 1
#> 4 1 x 1
|
with_tbl(tbl[] <- data.frame(1, "x"))
#> Error in `[<-`:
#> ! Can't recycle input of size 2 to size 3.
|
|
with_tbl(tbl[] <- data.frame(4:1, "x", 2))
#> # A tibble: 4 × 3
#> a b cd
#> <int> <chr> <dbl>
#> 1 4 x 2
#> 2 3 x 2
#> 3 2 x 2
#> 4 1 x 2
|
|
with_tbl(tbl[] <- data.frame(1, "x", 2))
#> # A tibble: 4 × 3
#> a b cd
#> <dbl> <chr> <dbl>
#> 1 1 x 2
#> 2 1 x 2
#> 3 1 x 2
#> 4 1 x 2
|
with_df(df[] <- data.frame(1, "x", 2, 3))
#> Warning in
#> `[<-.data.frame`(`*tmp*`, , value =
#> structure(list(X1 = 1, X.x. = "x",
#> : provided 4 variables to replace 3
#> variables
#> a b cd
#> 1 1 x 2
#> 2 1 x 2
#> 3 1 x 2
#> 4 1 x 2
|
with_tbl(tbl[] <- data.frame(1, "x", 2, 3))
#> Error in `[<-`:
#> ! Can't recycle input of size 4 to size 3.
|
|
with_tbl(tbl[] <- tbl)
#> # A tibble: 4 × 3
#> a b cd
#> <int> <chr> <list>
#> 1 1 e <dbl [1]>
#> 2 2 f <int [2]>
#> 3 3 g <int [3]>
#> 4 4 h <chr [1]>
|
|
with_tbl(tbl[,] <- 1)
#> # A tibble: 4 × 3
#> a b cd
#> <dbl> <dbl> <dbl>
#> 1 1 1 1
#> 2 1 1 1
#> 3 1 1 1
#> 4 1 1 1
|
|
with_tbl(tbl[,] <- 4:1)
#> # A tibble: 4 × 3
#> a b cd
#> <int> <int> <int>
#> 1 4 4 4
#> 2 3 3 3
#> 3 2 2 2
#> 4 1 1 1
|
with_df(df[,] <- 3:1)
#> a b cd
#> 1 3 2 1
#> 2 2 1 3
#> 3 1 3 2
#> 4 3 2 1
|
with_tbl(tbl[,] <- 3:1)
#> Error in `[<-`:
#> ! Assigned data `3:1` must
#> be compatible with existing data.
#> ✖ Existing data has 4 rows.
#> ✖ Assigned data has 3 rows.
#> ℹ Only vectors of size 1 are
#> recycled.
#> Caused by error in `vectbl_recycle_rhs_rows()` at tibble/R/subassign-backend.R:35:5:
#> ! Can't recycle input of size 3 to size 4.
|
with_df(df[,] <- 5:1)
#> Error in `[<-.data.frame`(`*tmp*`, , , value = 5:1): replacement has 5 items, need 12
|
with_tbl(tbl[,] <- 5:1)
#> Error in `[<-`:
#> ! Assigned data `5:1` must
#> be compatible with existing data.
#> ✖ Existing data has 4 rows.
#> ✖ Assigned data has 5 rows.
#> ℹ Only vectors of size 1 are
#> recycled.
#> Caused by error in `vectbl_recycle_rhs_rows()` at tibble/R/subassign-backend.R:35:5:
#> ! Can't recycle input of size 5 to size 4.
|
with_df(df[,] <- data.frame(1, "x"))
#> a b cd
#> 1 1 x 1
#> 2 1 x 1
#> 3 1 x 1
#> 4 1 x 1
|
with_tbl(tbl[,] <- data.frame(1, "x"))
#> Error in `[<-`:
#> ! Can't recycle input of size 2 to size 3.
|
|
with_tbl(tbl[,] <- data.frame(4:1, "x", 2))
#> # A tibble: 4 × 3
#> a b cd
#> <int> <chr> <dbl>
#> 1 4 x 2
#> 2 3 x 2
#> 3 2 x 2
#> 4 1 x 2
|
|
with_tbl(tbl[,] <- data.frame(1, "x", 2))
#> # A tibble: 4 × 3
#> a b cd
#> <dbl> <chr> <dbl>
#> 1 1 x 2
#> 2 1 x 2
#> 3 1 x 2
#> 4 1 x 2
|
with_df(df[,] <- data.frame(1, "x", 2, 3))
#> Warning in
#> `[<-.data.frame`(`*tmp*`, , , value
#> = structure(list(X1 = 1, : provided
#> 4 variables to replace 3 variables
#> a b cd
#> 1 1 x 2
#> 2 1 x 2
#> 3 1 x 2
#> 4 1 x 2
|
with_tbl(tbl[,] <- data.frame(1, "x", 2, 3))
#> Error in `[<-`:
#> ! Can't recycle input of size 4 to size 3.
|
|
with_tbl(tbl[,] <- tbl)
#> # A tibble: 4 × 3
#> a b cd
#> <int> <chr> <list>
#> 1 1 e <dbl [1]>
#> 2 2 f <int [2]>
#> 3 3 g <int [3]>
#> 4 4 h <chr [1]>
|