rmysql

install RMySQL for Mac

佐手、 提交于 2019-12-02 03:06:27
问题 I get below error when I try to install Mysql package (MAC OS) install.packages('RMySQL') package ‘RMySQL’ is available as a source package but not as a binary Warning in install.packages : package ‘RMySQL’ is not available (for R version 3.1.0) I am not sure what I need to set in order for this to work. 回答1: The author of RMySQL no longer provide binary packages, so you will have to build from source. I have posted the complete solution in another thread: Installing RMySQL in mavericks.

install RMySQL for Mac

我只是一个虾纸丫 提交于 2019-12-02 01:30:30
I get below error when I try to install Mysql package (MAC OS) install.packages('RMySQL') package ‘RMySQL’ is available as a source package but not as a binary Warning in install.packages : package ‘RMySQL’ is not available (for R version 3.1.0) I am not sure what I need to set in order for this to work. RyanLeiTaiwan The author of RMySQL no longer provide binary packages , so you will have to build from source. I have posted the complete solution in another thread: Installing RMySQL in mavericks . Basically, in order for install.packages('RMySQL', type='source') to work correctly, what you

Acessing SQL database using shiny with reactive query

折月煮酒 提交于 2019-12-02 00:28:47
I want to use Shiny to let a user build a data frame by accessing an SQL data base. I want it to work in the following way (but open to suggestions): User types in ID (its a number) User presses action button Reactive query is generated Query is sent and data is retrieved, and added to data frame User types in next ID... Here is my attempt: UI library(markdown) shinyUI(fluidPage( titlePanel("Generic grapher"), sidebarLayout( sidebarPanel( numericInput("wafer", label = h3("Select wafer ID:"), value = NULL), actionButton("do", "An action button") ), mainPanel( verbatimTextOutput("value"),

LAST_INSERT_ID() always returns 0 (RMySQL) - separate connection issue

安稳与你 提交于 2019-12-01 18:08:58
Original example as found in some post According to this post the following SQL statements should give me a vector 1, 2, 2, 2, 2 in the end: require("RMySQL") con <- dbConnect( dbDriver("MySQL"), db="your_db", user="your_user", password="your_pw", host="localhost" ) > con <MySQLConnection:(6640,122)> > dbSendQuery(con, "DROP TABLE IF EXISTS t;") <MySQLResult:(6640,122,0)> > dbSendQuery(con, "CREATE TABLE t (i INT NOT NULL AUTO_INCREMENT PRIMARY KEY);") <MySQLResult:(6640,122,1)> > dbSendQuery(con, "INSERT INTO t VALUES(NULL);") <MySQLResult:(6640,122,2)> > dbGetQuery(con, "SELECT LAST_INSERT

LAST_INSERT_ID() always returns 0 (RMySQL) - separate connection issue

允我心安 提交于 2019-12-01 17:41:56
问题 Original example as found in some post According to this post the following SQL statements should give me a vector 1, 2, 2, 2, 2 in the end: require("RMySQL") con <- dbConnect( dbDriver("MySQL"), db="your_db", user="your_user", password="your_pw", host="localhost" ) > con <MySQLConnection:(6640,122)> > dbSendQuery(con, "DROP TABLE IF EXISTS t;") <MySQLResult:(6640,122,0)> > dbSendQuery(con, "CREATE TABLE t (i INT NOT NULL AUTO_INCREMENT PRIMARY KEY);") <MySQLResult:(6640,122,1)> > dbSendQuery

SQL query for GROUP BY, return groups that match the conditions of LEAST, COALESCE

梦想的初衷 提交于 2019-12-01 07:36:33
问题 I want to write an SQL query calling for several columns with a bit complicated conditions. I'm working on R Studio using RMySQL package. My server is MySQL. The table looks like this. organisation Tour_ID A B C D Ikea a 2018-04-01 2018-05-07 2018-05-09 2018-05-01 Ikea a 2018-06-01 2018-05-03 2018-05-29 NA Ikea a 2018-04-02 2018-05-01 2018-07-08 2018-05-26 Ikea b 2018-06-02 2018-05-01 NA 2018-05-26 Ikea b 2018-06-02 2018-05-01 NA 2018-05-26 Ikea b NA 2018-05-05 2018-08-02 2018-06-01 Ikea c

Insert in RMySQL from data frame

不打扰是莪最后的温柔 提交于 2019-11-30 14:13:11
问题 Im trying to add data to MySQL table by using RMySQL. I only need to add one row at a time and it's not working. What I'm trying to do is this. dbGetQuery(con,"INSERT INTO names VALUES(data[1,1], data[1,2])") so what I'm doing is that I have values in data frame that is named as "data" and I need to put them into mysql table. before that I will check them if they are already in the table or not and if they are not then I will add them, but that way it isn't working. The data is read from .csv

Fastest way to subset - data.table vs. MySQL

↘锁芯ラ 提交于 2019-11-30 12:37:19
问题 I'm an R user, and I frequently find that I need to write functions that require subsetting large datasets (10s of millions of rows). When I apply such functions over a large number of observations, it can get very time consuming if I'm not careful about how I implement it. To do this, I have sometimes used the data.table package, and this provides much faster speeds than subsetting using data frames. Recently, I've started experimenting with packages like RMySQL, pushing some tables to mysql

Connect to MySQL database with RMySQL

久未见 提交于 2019-11-30 03:46:34
I am making the move from RSQLite to RMySQL and I am confused by the user and password fields. FWIW, I'm running Windows 7, R 2.12.2, MySQL 5.5 (all 64 bit), and RMySQL 0.7-5. I installed RMySQL as prescribed in this previous SO question , and as far as I know it works (i.e., I can load the package with library(RMySQL) ). But when I try to run the tutorial from the R data import guide , I get a "failed to connect to database..." error. This is the code from the tutorial from the guide: library(RMySQL) # will load DBI as well ## open a connection to a MySQL database con <- dbConnect(dbDriver(

Fastest way to subset - data.table vs. MySQL

风格不统一 提交于 2019-11-30 03:44:54
I'm an R user, and I frequently find that I need to write functions that require subsetting large datasets (10s of millions of rows). When I apply such functions over a large number of observations, it can get very time consuming if I'm not careful about how I implement it. To do this, I have sometimes used the data.table package, and this provides much faster speeds than subsetting using data frames. Recently, I've started experimenting with packages like RMySQL, pushing some tables to mysql, and using the package to run sql queries and return results. I have found mixed performance