I would recommend that you read the excellent documentation for the odbc package.
If you want to use a connection string it will look something like this below (it can also be specified with params):
library(DBI)
con <- dbConnect(odbc::odbc(),
.connection_string = 'driver={SQL Server};server=[SERVER_NAME];database=[DATABASE_NAME];trusted_connection=true')
Alternatively, what I think is an easy solution is to create a system DSN.
In Windows:
- search for ODBC Data Source (64-bit)
- use the SQL server driver
- Name, describe and write the server name.
When you've created your system DSN then you can connect like below and start querying the database:
library(DBI)
con <- dbConnect(odbc::odbc(), "VIPDATA")
I hope it helps. Remember to close your connection when you are done.