ODBC -SQLQUERY和日期格式
我正在尝试使用RODBC从MySQL数据库中检索数据 命令ODBCCONNECT和SQLQUERY。在 数据库,在某些情况下它可以毫无困难。不过我 其中一些错误,似乎与日期格式有关。由于我对MySQL不熟悉,我希望在这里得到一些想法。
我的代码看起来如下:
library(RODBC)
mycon<-odbcConnect("nicer_64")
> data1<-sqlQuery(mycon,paste("select PID, NAME, FIRSTNAME1, SEXE from a_patient;"))
> head(data1)
PID NAME FIRSTNAME1 SEXE
1 22145 PILLONEL GASTON ANTONIN 1
2 22146 PORCHER HENRIETTE MARIE 2
3 22147 PUGIN AUGUSTE JOSEPH 1
4 21437 HEIZ MARIE ANTOINETTE 2
5 21439 KALT OTTO 1
6 2144 BRUNNER MARIE 2
> data2<-sqlQuery(mycon,paste("select PID, NAME, FIRSTNAME1, BIRTHDATE, SEXE from a_patient;"))
Error in as.POSIXlt.character(x, tz, ...) :
la chaîne de caractères n'est pas dans un format standard non ambigu
> head(data2)
Error in head(data2) : object 'data2' not found
非常感谢!
I am trying to retrieve data from a MySQL Database using RODBC with the
commands odbcConnect and sqlQuery. There are different tables in the
database and in some cases it works without any difficulties. Nevertheless I
get an error with some of them and it seems to be related to date format. Since I'm not familiar with MySQL I hope to get some ideas here.
My code looks as follows:
library(RODBC)
mycon<-odbcConnect("nicer_64")
> data1<-sqlQuery(mycon,paste("select PID, NAME, FIRSTNAME1, SEXE from a_patient;"))
> head(data1)
PID NAME FIRSTNAME1 SEXE
1 22145 PILLONEL GASTON ANTONIN 1
2 22146 PORCHER HENRIETTE MARIE 2
3 22147 PUGIN AUGUSTE JOSEPH 1
4 21437 HEIZ MARIE ANTOINETTE 2
5 21439 KALT OTTO 1
6 2144 BRUNNER MARIE 2
> data2<-sqlQuery(mycon,paste("select PID, NAME, FIRSTNAME1, BIRTHDATE, SEXE from a_patient;"))
Error in as.POSIXlt.character(x, tz, ...) :
la chaîne de caractères n'est pas dans un format standard non ambigu
> head(data2)
Error in head(data2) : object 'data2' not found
Many thanks in advance!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论