swirldev / swirl_courses

:mortar_board: A collection of interactive courses for the swirl R package.
http://swirlstats.com
Other
4.32k stars 7.24k forks source link

remove deprecated function tbl_df #447

Open wmorgan485 opened 4 years ago

wmorgan485 commented 4 years ago

Replace the deprecated function dplyr::tbl_df() with tibble::as_tibble() and make corresponding changes to the text

acromarcopolo commented 3 years ago

This is ~1.5yr later, doing the "Getting and Cleaning Data" assignment and got the warning "tbl_df() was deprecated in dplyr 1.0.0. Please use tibble::as_tibble() instead." ... a few lines later we are asked to use tbl_df(). Will this be fixed soon? Looks like it still works, still it would make sense to get us on board with the current way of using dplyr.

Scoodood commented 2 years ago

As problem here.

 Please choose a course, or type 0 to exit swirl.

1: Getting and Cleaning Data
2: Take me to the swirl course repository!

Selection: 1

| Please choose a lesson, or type 0 to return to course menu.

1: Manipulating Data with dplyr
2: Grouping and Chaining with dplyr
3: Tidying Data with tidyr
4: Dates and Times with lubridate

Selection: 2

| Attempting to load lesson dependencies...

| Package ‘dplyr’ loaded correctly!

  |                                                                          |   0%

| Warning: This lesson makes use of the View() function. View() may not work
| properly in every programming environment. We highly recommend the use of RStudio
| for this lesson.

...

  |=                                                                         |   2%
| In the last lesson, you learned about the five main data manipulation 'verbs' in
| dplyr: select(), filter(), arrange(), mutate(), and summarize(). The last of
| these, summarize(), is most powerful when applied to grouped data.

...

  |===                                                                       |   4%
| The main idea behind grouping data is that you want to break up your dataset into
| groups of rows based on the values of one or more variables. The group_by()
| function is reponsible for doing this.

...

  |====                                                                      |   6%
| We'll continue where we left off with RStudio's CRAN download log from July 8,
| 2014, which contains information on roughly 225,000 R package downloads
| (http://cran-logs.rstudio.com/).

...

  |======                                                                    |   8%
| As with the last lesson, the dplyr package was automatically installed (if
| necessary) and loaded at the beginning of this lesson. Normally, this is
| something you would have to do on your own. Just to build the habit, type
| library(dplyr) now to load the package again.

warning messages from top-level task callback 'mini'
Warning message:
`tbl_df()` was deprecated in dplyr 1.0.0.
Please use `tibble::as_tibble()` instead.
This warning is displayed once every 8 hours.
Call `lifecycle::last_lifecycle_warnings()` to see where this warning was generated. 

Follow the on-screen instructions to trace error

> lifecycle::last_lifecycle_warnings()
[[1]]
<deprecated>
message: `tbl_df()` was deprecated in dplyr 1.0.0.
Please use `tibble::as_tibble()` instead.
Backtrace:
Error in `arg_match0()`:
! `arg` must be a string or have the same length as `values`.
Run `rlang::last_error()` to see where the error occurred.
> rlang::last_error()
<error/rlang_error>
Error in `arg_match0()`:
! `arg` must be a string or have the same length as `values`.
---
Backtrace:
  1. base (local) `<fn>`(x)
  2. lifecycle:::print.lifecycle_warning_deprecated(x)
  3. lifecycle:::print_trace(x, ..., simplify = simplify)
 12. rlang:::format.rlang_trace(trace, ..., simplify = simplify)
 13. rlang:::arg_match_simplify(simplify)
 14. rlang::arg_match0(simplify, c("none", "branch"), error_call = call)
Run `rlang::last_trace()` to see the full context.

| That's not exactly what I'm looking for. Try again. Or, type info() for more
| options.

| Use library(dplyr) to load the dplyr package.

> rlang::last_trace()
<error/rlang_error>
Error in `arg_match0()`:
! `arg` must be a string or have the same length as `values`.
---
Backtrace:
     ▆
  1. ├─base (local) `<fn>`(x)
  2. ├─lifecycle:::print.lifecycle_warning_deprecated(x)
  3. │ └─lifecycle:::print_trace(x, ..., simplify = simplify)
  4. │   ├─lifecycle:::cat_line(red(format(trace, ..., simplify = simplify)))
  5. │   │ ├─base::cat(paste0(..., "\n", collapse = ""))
  6. │   │ └─base::paste0(..., "\n", collapse = "")
  7. │   ├─lifecycle:::red(format(trace, ..., simplify = simplify))
  8. │   │ └─crayon::red(x)
  9. │   │   └─crayon:::mypaste(...)
 10. │   │     └─base::lapply(list(...), as.character)
 11. │   ├─base::format(trace, ..., simplify = simplify)
 12. │   └─rlang:::format.rlang_trace(trace, ..., simplify = simplify)
 13. │     └─rlang:::arg_match_simplify(simplify)
 14. │       └─rlang::arg_match0(simplify, c("none", "branch"), error_call = call)
 15. └─rlang::abort(message = message, call = call)

| One more time. You can do it! Or, type info() for more options.

| Use library(dplyr) to load the dplyr package.

>