[R] Imported tables from Access 2007
David Winsemius
dwinsemius at comcast.net
Thu Mar 18 22:47:46 CET 2010
On Mar 18, 2010, at 5:43 PM, David Winsemius wrote:
>
> On Mar 18, 2010, at 4:46 PM, Ryan Utz wrote:
>
>> 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")
>
> I am surprised that worked. I was under the impression won
^^one^^ ... ,sigh.
> needed to double the back-slashes or use "/"'s. But then I don't use
> Access or odbc, so I may be completely off base.
>
>> 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:
>
> Please post the results of str(data.table)
>
> There will almost certainly be variable names. They may need to be
> quoted if you have spaces or other special characters in them.
>
> --
> David.
>
>>
>> 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
>>
>> ______________________________________________
>> R-help at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>
> David Winsemius, MD
> West Hartford, CT
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
David Winsemius, MD
West Hartford, CT
More information about the R-help
mailing list