Displaying 4 results from an estimated 4 matches for "merchants2".
Did you mean:
merchants
2010 Apr 28
0
Error loading RMySQL
...a perl script
that does an initial preparation of the data, and then invokes the R script
- all of which work fine).
The very last five lines of my script are:
print(resultsdataframe);
library(RMySQL);
con <-
dbConnect(MySQL(),user="rejbyers",password="jesakos",dbname="merchants2");
dbWriteTable(con,"results",resultsdataframe);
dbDisconnect(con);
The print statement works fine, and shows me the results I expected. But
library(RMySQL) fails, which makes all the rest of the lines fail. The
command and error message is:
> library(RMySQL);
> Error in f...
2010 Jul 21
0
One problem with RMySQL and a query that returns an empty recordset
...never
see about two thirds of the results that ought to be produced.
At the time that the error occurs, x contains the following SQL query:
SELECT m_id,sale_date,YEAR(sale_date) AS sale_year,MONTH(sale_date) AS
sale_month,return_type,0.0001 + DATEDIFF(return_date,sale_date) AS
elapsed_time FROM `merchants2`.`risk_input` WHERE m_id = 361 AND return_type
= 1 AND DATEDIFF(return_date,sale_date) IS NOT NULL;
If I execute this SQL, I find the resultset is empty. So assigning the
value returned by dbGetQuery to moreinfo works ONLY if the resultset is not
empty. It fails with a fatal error if the results...
2008 Oct 08
0
Applying an R script to data within MySQL? How to?
...y(DBI)
> library(RMySQL)
> MySQL(max.con = 16, fetch.default.rec = 500, force.reload = F)
<MySQLDriver:(3800)>
> m <- dbDriver("MySQL")
> con <- dbConnect(m, user="rejbyers", password = "jesakos",
> host="localhost", dbname = "merchants2")
> rs <- dbSendQuery(con, "select * from merchants")
> df <- fetch(rs, n = 150)
> df
And of course, that last statement is followed by the entire contents of
"merchants"
Now, I have a script like the following:
refdata18 = read.csv("K:\\MerchantData\\...
2010 Jul 16
1
I need help making a data.fame comprised of selected columns of an original data frame.
I must have missed something simple, but still, i don't know what.
I obtained my basic data as follows:
x <- sprintf("SELECT m_id,sale_date,YEAR(sale_date) AS
sale_year,WEEK(sale_date) AS sale_week,return_type,0.0001 +
DATEDIFF(return_date,sale_date) AS elapsed_time FROM
`merchants2`.`risk_input` WHERE DATEDIFF(return_date,sale_date) IS NOT
NULL")
moreinfo <- dbGetQuery(con, x)
I then made the data frame I want to use as follows:
fun_m_id <- function(df)
if (length(df$elapsed_time) > 5) {
rv = fitdist(df$elapsed_time,"exp")
rv$mid = df$m_id[...