Skip to content

Tag: dbplyr

How to add a vector to a table in backend using dbplyr (R)

I created a table from a data source using tbl(). I need to add a column including 1:nrow() to my dataset and tried different methods but I didn’t succeed. My code is as below: It doesn’t add column ID to my dataset and only adds column step. Using as.data.frame(), it works but so slow. Do you hav…

How can I translate this SQL code to R script using dplyr?

I’m currently working on a project and I want to summarize a column from a joined table twice. SQL code is this: …and the result is this: Database tables are as shown here: I hope that I have provided all the information needed. Question: How can I have the same result in R by only using dplyr lib…

Connect to a DB using DBplyr

Problem I am trying to connect to a SQL Server which is on premises using dbplyr using the instructions here but I keep getting an error saying Invalid object name For simplicity I am using the same object naming convention as RStudio has in the instructions at the link above. Code that produces the error I u…