-
Notifications
You must be signed in to change notification settings - Fork 129
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
Problem with subassignment operator in version 3.1.0 #868
Comments
I have just responded to an email from CRAN saying my pct package will be removed on 18th March (in 3 days) unless fallout from this issue was resolved. I replied as follows: I have checked the tests: https://cran.r-project.org/web/checks/check_results_pct.html
Is it OK to wait for these issues to be fixed upstream? In case anyone else is seeing CRAN checks fail because of this issue, it may be helpful to get an update on this, e.g. 'wip' or 'wontfix'. Heads up @krlmlr and other tibble developers. Thanks. |
Thanks. Is this a duplicate of #773? Please work around for now. |
I think it is more or less the same problem. Moreover, I don't know exactly the rules behind subset-assignment for # packages
library(tibble)
# data
x <- tibble(
a = TRUE,
b = 1L,
c = sqrt(2),
d = 3i + 1,
e = "e",
f = raw(1),
)
x
#> # A tibble: 1 x 6
#> a b c d e f
#> <lgl> <int> <dbl> <cpl> <chr> <raw>
#> 1 TRUE 1 1.41 1+3i e 00
# subset-assign 0 row
x[FALSE, "a"] <- NA
x[FALSE, "b"] <- NA
x[FALSE, "c"] <- NA
x[FALSE, "d"] <- NA
x[FALSE, "e"] <- NA
#> Error: Assigned data `NA` must be compatible with existing data.
#> i Error occurred for column `e`.
#> x Can't convert <logical> to <character>.
x[FALSE, "f"] <- NA
#> Error: Assigned data `NA` must be compatible with existing data.
#> i Error occurred for column `f`.
#> x Can't convert <logical> to <raw>.
x
#> # A tibble: 1 x 6
#> a b c d e f
#> <lgl> <int> <dbl> <cpl> <chr> <raw>
#> 1 TRUE 1 1.41 1+3i e 00 while, when I consider subset-assignment with 1 row, x[1, "a"] <- NA
x[1, "b"] <- NA
x[1, "c"] <- NA
x[1, "d"] <- NA
x[1, "e"] <- NA
x[1, "f"] <- NA
x
#> # A tibble: 1 x 6
#> a b c d e f
#> <lgl> <int> <dbl> <cpl> <chr> <raw>
#> 1 NA NA NA NA <NA> 00 Created on 2021-03-18 by the reprex package (v1.0.0) |
It's a different issue, #773 is about assigning a value to an all- |
I have a PR ready that fixes this and the sister issue #773. Before actually merging, I'd like to rethink if we really want this, or if we'd rather prefer consistent failure in all cases. Requiring typed What do you think? CC @lionel-. |
On the other hand, in #773 (comment), @hadley suggests:
Following that, this means that we might not need this extra safety, but also raises the following questions that should be resolved in vctrs:
The answer might be "No", "Yes" and "Yes", with severe implications, but again it should be decided elsewhere. |
This old thread has been automatically locked. If you think you have found something related to this, please open a new issue and link to this old issue if necessary. |
Dear package developers, I want to report a problematic interaction between
tibble
andtmap
that was reported by @Robinlovelace a few hours ago in the tmap repository. I think that the problem is not really related totmap
, but it can be summarised as follows:Created on 2021-03-02 by the reprex package (v0.3.0)
Session info
The same code should work with version
3.0.6
:Created on 2021-03-02 by the reprex package (v0.3.0)
Session info
More details about the original issue: https://github.com/mtennekes/tmap/issues/551
EDIT:
The same code works with regular
data.frame
:Created on 2021-03-02 by the reprex package (v0.3.0)
The text was updated successfully, but these errors were encountered: