[R] Imported tables from Access 2007

Ryan Utz rutz at umces.edu
Thu Mar 18 21:46:29 CET 2010


Hi all,

I am very new to R and I'm trying to import data from Microsoft Access. So
far, I've managed to do so successfully using the following code:

testdb <- file.path("c:\Databse.accdb")
channel2 <- odbcConnectAccess2007(testdb)
data.table <- sqlFetch(channel2,"data")

This successfully imports a table(?) called "data.table".

But when I try to run basic stats or manipulate the data I've imported, I
can only do so when specifying "data.table", rather than the variables
names (like one can do when importing Excel data. For instance, I need to
specify:

var_3<-data.table[[1]]-data.table[[2]]

or

lm.1<-lm(data.table[[1]]~data.table[[4]])

Any way I can change the import process so that R recognizes variable
names? Or at least change what I'm importing so that I can simply use the
variables names stored in Access? I've tried various combinations of
"columnnames=TRUE" and "rownames=FALSE" with no success (or at least
anything that makes sense).

Thanks ahead of time for any input or advice...

Ryan



More information about the R-help mailing list