gather() for SQL translation

I have an sql table which I would like to pull into Rstudio using dplyr::tbl(). I would then like to use gather(), but I get the error.

Error in UseMethod("gather_") :
no applicable method for 'gather_' applied to an object of class "c('tbl_dbi', 'tbl_sql', 'tbl_lazy', 'tbl')"

Also, when reading I did not see any info on using gather

I just wanted to:

  1. Confirm that gather() is not available for SQL translation.
  2. Know possible alternatives to gather()
1 Like

Yes, gather is not available for SQL yet. There is dedicated issue here - There is also a comment by iangow that he references that implements it using already existing verbs in dplyr.

One alternative can be replyr - I've never used it myself, but at least following the blog-posts of the author I've got an impression that it might solve your problem with gather.


Actually replyr is in maintenance mode. However the newer package cdata does supply the SQL equivalent of gather,


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