My last query related to this referred to a problem with not being able to
store data.  A suggestion was made to try to convert the data returned by
fitdist into a data.frame before using rbind.  That failed, but provided the
key to solving the problem (which was to create a data.frame using the
variables fitdist produces in the object it returns).

I now have almost everything working as intended.  However, there is one
problem.

Here is the error:

'data.frame':    0 obs. of  0 variables
Error in `[.data.frame`(moreinfo, , 1) : undefined columns selected
Calls: [ -> [.data.frame
Execution halted

the curious thing is that this happens when my script is called from within
perl.  Within Rgui, the script continues through to the end, but the loop
that is involved terminates at the line where this error occurs.  The line
that results in this error is:

      moreinfo <- dbGetQuery(con, x)

This statement occurs in a loop that ought to iterate over a few hundred
values for m_id (see the SQL below).  Because of the above error, I 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 resultset is empty.  So, the
question is, how can I revise that statement so that the assignment happens
only if the resultset is NOT empty?

Thanks

Ted

        [[alternative HTML version deleted]]

______________________________________________
R-help@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.

Reply via email to