How to make a reproducible example of a database connection?

From time to time I need to make reproducible examples about errors I get when querying a database; sometimes these errors cannot be reproduced using the built-in datasets.

Is there any list of publicly available databases that we can use to make reproducible examples? I knew about his one

 src_mysql(dbname = "dplyr", 
                 host = "dplyr.csrrinzqubik.us-east-1.rds.amazonaws.com", 
                 port = 3306, 
                 user = "dplyr",
                 password = "dplyr")

But it gives me an error

Error in .local(drv, ...) : 
  Failed to connect to database: Error: Unknown MySQL Server Host 'dplyr.csrrinzqubik.us-east-1.rds.amazonaws.com' (8)

I didn't find any reference to this specific circumstance in the notorious question How to make a great R reproducible example?


来自http://shiny.rstudio.com/articles/

library(dplyr)
my_db <- src_mysql(
  dbname = "shinydemo",
  host = "shiny-demo.csa7qlmguqrf.us-east-1.rds.amazonaws.com",
  user = "guest",
  password = "guest"
)
# get the first 5 rows:
my_db %>% tbl("City") %>% head(5)
链接地址: http://www.djcxy.com/p/24836.html

上一篇: 使用dplyr窗口函数来计算百分位数

下一篇: 如何制作一个可重复的数据库连接示例?