[R] Saving Rdataframe into a SQL Server Schema and updating the resulting table

Vijay Chowdhari vijaychowdhari at gmail.com
Fri Jan 16 17:37:52 CET 2015


Hi all

Can someone assist me in creating a table in SQL Server using a Rdataframe
as well as updating it with new records

Here's my sample script in R.

library(RODBC)


#Connecting to Datum
myconn <-odbcConnect("Datum", uid="bihy", pwd="tarta") ### Server name is
Datum

Now I would like to save my rdataframe in a schema in Datum called Sandbox.
Here's this is what my rdataframe looks like

df<-
datatime             devicetype           instances
2013-10-01          mobilephone         400
2013-10-01          tablet                   300
2013-10-01          desktop                200


a) How can I save this df to a table in the Sandbox schema in the datum
server
b) additionally how can I update the resulting table with new data i.e.

datatime             devicetype           instances
2013-10-02         mobilephone         500
2013-10-02          tablet                   100
2013-10-02          desktop                400

I'm looking to get a table in the sandbox schema that has the most up to
date data. I have tried using the sqlsave function, however, I cannot seem
to be able to store data in a particular schema..

Any help would be appreciated

Thanks

	[[alternative HTML version deleted]]



More information about the R-help mailing list