-
Notifications
You must be signed in to change notification settings - Fork 131
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
Indexing is a bit odd in the new tibble #760
Comments
I don't see a problem description here. |
@krlmlr I am very sorry. My internet crashed around the time I tried to posting this, so I didn't think it posted. I have updated it. |
Thanks. Now: library(tidyverse)
partition <- as.matrix(data.frame(Resample = c(1, 2, 3, 4)))
# Create a data frame of y response and x1 predictor
# with intentionally unusually naming due to inherited data issue.
y.variable <- as.factor(c("false_318", "false_318", "false_318", "true_130", "true_130"))
x1 <- c(3225067, 6907531, 6911683, 6991870, 2222)
mydata <- tibble(y.variable = y.variable, x1 = x1)
mydata[partition, ]
#> Warning: The `i` argument of ``[`()` can't be a matrix as of tibble 3.0.0.
#> Convert to a vector.
#> This warning is displayed once every 8 hours.
#> Call `lifecycle::last_warnings()` to see where this warning was generated.
#> # A tibble: 4 x 2
#> y.variable x1
#> <fct> <dbl>
#> 1 false_318 3225067
#> 2 false_318 6907531
#> 3 false_318 6911683
#> 4 true_130 6991870 Created on 2020-04-17 by the reprex package (v0.3.0) |
tibble 3.0.1 - `[<-.tbl_df()` coerces matrices to data frames (#762). - Use delayed import for cli to work around unload problems in downstream packages (#754). - More soft-deprecation warnings are actually visible. - If `.name_repair` is a function, no repair messages are shown (#763). - Remove superseded signal for `as_tibble.list()`, because `as_tibble_row()` only works for size 1. - `as_tibble(validate = )` now always triggers a deprecation warning. - Subsetting and subassignment of rows with one-column matrices work again, with a deprecation warning (#760). - Attempts to update a tibble row with an atomic vector give a clearer error message. Recycling message for subassignment appears only if target size is != 1. - Tweak title of "Invariants" vignette.
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. |
Is the new invariants article set in stone or would be possible to make a documentation request?
This error will product the error "Error:
i
must have one dimension, not 2." However, by simply playing around a bit I figured out a work around.I am not strong it R, but for me it seemed a named vector [n,1] and ""matrix"" (really a vector) that is nx1 (n rows and 1 column) was the reason for the error. I researched more into this error and came across this page (https://github.com/tidyverse/tibble/blob/master/NEWS.md) and this:
This made it clear that there are probably very good reasons that a named vector or a literal [nx1] area can no longer be passed into a list. However, I was hoping the documentation could include more examples so its a bit more clear to new users.
Thank you for your time,
mlane
The text was updated successfully, but these errors were encountered: