Skip to content
Advertisement

Tag: r

Intersect two sf data.frames based on date and geometry using R

So, I have two R “sf” “data.frames”, one with millions of linestring geometries (vsr_segments: see below) and the other with 5 polygons (vsr_zones: see below). Each linestring has a datetime and each polygon has a unique date range. I’m trying to intersect the linestrings dataframe with the polygon data.frame based on whether the linestring datetime falls within a specific polygon’s

Count based on multiple conditions using sqldf

Hi all I’m writing a sql query on R using sqldf and seem to hit a roadblock. I have a table with an Id column, two dates columns and a grouping by column. The query I’m writing is From this query the result I’m getting is Whichis correct based on the query. What I want to achieve is if my

how to export data from SQL in R

I’m a beginner in R. I have connection via ODBC to SQL DB: dbconnection <- odbcDriverConnect("Driver=ODBC Driver 11 for SQL Server;Server=OurServer; Database=OurDatabase;Uid=; Pwd=") initdata <...

How to compose query properly using dbGetQuery command?

I have a small database in PostgresSQL. And I connected to it via R-studio and try to retrieve data from database. I wrote a command, but it doesn’t work. And I don’t know what’s the problem. Please, help me. So, the code works well. But these two codes fail Where con is the postgres connection object. And of course query

Preserving times Class with sqldf

I am using sqldf to join several tables, but I am having trouble preserving the times class set with the chron package on a column. I used the method=”name__class” argument to the sqldf function and …

Advertisement