library(RODBC)
dbconnection <- odbcDriverConnect("Driver=ODBC Driver 11 for SQL Server;
Server=YourDBName\\SQLEXPRESS;
Database=TestDB;
Uid=;
Pwd=;
trusted_connection=yes")
initdata <- sqlQuery(dbconnection,paste("select * from MyTable;"))
odbcClose(dbconnection)