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…
Tag: dbplyr
Syntax error in SQL code being used in R, no row_number function found
I am using RSQLite, DBI, and dbplyr packages. I’m watching this YouTube video by TechTFQ. I’m getting a syntax error with this line. Error: near “row_number”: syntax error I’m certain that the SQL syntax I’m writing here is the same as what I’m watching in the YouTube…
R using RSQLite, DBI and dbplyr, can’t have more than one table in the RSQLite in order to make a join
I’m having a hard time understanding the behavior of these three packages: RSQLite, DBI, and dbplyr. I’m using the mtcars dataframe and I’m loading it with the tibble package to add the car name as one of the rows. I also created my own table that has information about where all these cars w…
Select rows where array contains one of several values in bigquery (ideally with dbplyr)
I have a large set of tweets on bigquery and now want to filter those that contain at least one of a list of hashtags. The hashtags are saved in an array column (uploaded from a list column in R). How can I select rows that contain one of multiple values in any place in that array? Below the code
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…
How do you filter with a Dataframe, list, vector etc. to a table in a database in R?
I have a large set of id-s which is in a csv file. How could I filter on a database table using only that one-columned table in the csv file? For example in the ODBC database we have: TABLE 1 +–…
Can you name dbplyr’s simulated lazy tables?
dbplyr has some very useful-looking simulation functions so you can write queries while not connected to any real database, but I can’t seem to get actual table names into any of the queries I write …