Git Product home page Git Product logo

Comments (6)

hadley avatar hadley commented on June 29, 2024 1

While thinking through whether or not dplyr should have append_to() as an analog to copy_to() I realised one absolute principle of dplyr is that it never mutates data in place - it always creates a copy with the modifications. That means that append_to() is explicitly out of scope, and in general if you want to modify existing data you should be using DBI, not dplyr.

from db.rstudio.com.

edgararuiz-zz avatar edgararuiz-zz commented on June 29, 2024 1

Maybe we a Best Practice article called something like "Using dplyr and DBI with databases" could help with this. With an example, the article would show which function to use as the user progresses in the analysis. It would be an expanded version of the example in this RViews article: https://rviews.rstudio.com/2017/05/17/databases-using-r/

from db.rstudio.com.

hadley avatar hadley commented on June 29, 2024

Why would you be writing to a database table as part of an analysis?

from db.rstudio.com.

edgararuiz-zz avatar edgararuiz-zz commented on June 29, 2024

The example will start with a database that already has data we want to work with, as it is in most real cases. So, I see two scenarios we need to address:

  • The user has a small data set in R that they want to join to the data in the database

  • A query that results form dplyr code takes to long to re-run every time, so a temp table is needed

from db.rstudio.com.

nwstephens avatar nwstephens commented on June 29, 2024

Maybe instead of setting strict guidelines, we just do a comparison of methods between the two and leave it to the reader to decide. For example, I'm fairly certain that some users who want to do a select star will use dbgetquery even though there are many other ways to print a table.

from db.rstudio.com.

edgararuiz-zz avatar edgararuiz-zz commented on June 29, 2024

That's why I was thinking of an example. To me, this is a softer way to suggest a guideline that the user can take or leave.

from db.rstudio.com.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.