Im working on my first project for data analyst for my portfolio and i am hitting a wall here and im not sure what im over looking here. I am more then likely over thinking this

all_trips <- bind_rows(q1_2019, q1_2020)
Error in bind_rows():
! Can't combine ..1$started_at and ..2$started_at .
Run rlang::last_trace() to see where the error occurred.
rlang::last_trace()
<error/vctrs_error_ptype2>
Error in bind_rows():
! Can't combine ..1$started_at and ..2$started_at .


Backtrace:

  1. └─dplyr::bind_rows(q1_2019, q1_2020)
    Run rlang::last_trace(drop = FALSE) to see 15 hidden frames.

rlang::last_trace(drop = FALSE)
<error/vctrs_error_ptype2>
Error in bind_rows():
! Can't combine ..1$started_at and ..2$started_at .


Backtrace:

  1. ├─dplyr::bind_rows(q1_2019, q1_2020)
  2. │ └─vctrs::vec_rbind(!!!dots, .names_to = .id, .error_call = current_env())
  3. ├─vctrs (local) <fn>()
  4. │ └─vctrs::vec_default_ptype2(...)
  5. │ └─vctrs:::vec_ptype2_df_fallback(...)
  6. │ └─vctrs:::vec_ptype2_params(...)
  7. │ └─vctrs:::vec_ptype2_opts(...)
  8. └─vctrs (local) <fn>()
  9. └─vctrs::vec_default_ptype2(...)
  10. ├─base::withRestarts(...)
    
  11. │ └─base (local) withOneRestart(expr, restarts[[1L]])
    
  12. │   └─base (local) doWithOneRestart(return(expr), restart)
    
  13. └─vctrs::stop_incompatible_type(...)
    
  14.   └─vctrs:::stop_incompatible(...)
    
  15.     └─vctrs:::stop_vctrs(...)
    
  16.       └─rlang::abort(message, class = c(class, "vctrs_error"), ..., call = call)
    

Run

class(q1_2019$started_at)
class(q1_2020$started_at)

Are the two columns the same data type?

They are not this is what pops up

class(q1_2019$started_at)
[1] "hms" "difftime"
class(q1_2020$started_at)
[1] "character"

That explains the error. I expect the column of q1_2019 was transformed after being read into the data frame. You need to have the columns match in their data class before you combine them.
Also, the data classes "hms" "difftime" are unusual for a column named started_at that I expect stores a time of day, and not a length of time, which is the usual meaning of a difftime.

I think i see what the problem is now. In q1_2020 its set as "ymdhms"

Thank you this helped me noticed where i messed up long before this error

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.