Skip to content
Advertisement

Tag: r

Replace multiple variables in R Sql Query

I have a query similar like the one below where I need to use multiple string of characters to replace in a single query. I am not too sure how to make sure a and b are passed into the %s in the query. I am getting the error ‘unused arguments (b)’ Any advice please? Thanks Answer sQuote only takes

select the last 30 days of POSIXct dates in R

Probably simple, but this is my first time working with POSIXct date format. I have a table of orders (that i got from a syl database) and I would like to select all rows of the last 30 days. so today’s date minus 30 days. my date is of the type POSIXct. Now, I know how to do this selection

Translate SQL statement in R code using dplyr

I need help transalting an SQL statement regarding this dataset https://www.kaggle.com/datasets/hugomathien/soccer , into r code using dplyr. The SQL statement is : The r code that i have tried is: and i get this error : Error in dplyr::common_by(): ! by required, because the data sources have no common variables. Run rlang::last_error() to see where the error occurred. Run rlang::last_error()

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 have any ideas? thanks

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 video, except for the differences in the dataframe that I’m using and the

Converting XML to a dataframe R and extracting value from within

I have the following XML which I am trying to convert into a data frame in R or a table within SQL: I’ve tried using XMLtoDataFrame (“xml” library) but this just creates a table without any values. Would anyone be able to help with this please? Open to a SQL solution. Edit: I’m looking for my table to be in

Advertisement