Learn R Programming

ImportExport (version 1.3)

access_export: Export multiple R data sets to Microsoft Office Access

Description

Directly connect (and disconnect at the end) with the Microssoft Office Access database using the RODBC package and write one or multiple data sets.

Usage

access_export(file,x,tablename=as.character(1:length(x)),uid="",pwd="",...)

Arguments

file

The path to the file with .mdb extension.

x

Either a data frame or a list containing multiple data frame to be exported.

tablename

A character or a vector character containing the names that will receive the tables where the data frame is stored. If it is a vector, it must follow the same order as the data frames in x have. All names must be different from each others.

uid

see odbcConnect .

pwd

see odbcConnect .

...

see odbcConnect,sqlSave.

Value

No value is returned.

Details

Date variables are exported as an integer, they might be converted to character if a character representation in the access database is wanted.

Examples

Run this code
# NOT RUN {
# x is a data.frame
file<-("mydata.xlsx")
a<- 1:10
b<-rep("b",times=10)
c<-rep(1:2,each=5)
x<-data.frame(a,b,c)
excel_export(x,file,table_names="mydata")
# x is a list
y<-list(x,x[2:3])
excel_export(y,file,table_names=c("mydata1","mydata2"))
 
# }

Run the code above in your browser using DataLab