similar to: One problem with RMySQL and a query that returns an empty recordset

Displaying 20 results from an estimated 300 matches similar to: "One problem with RMySQL and a query that returns an empty recordset"

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,
2010 Jul 08
1
Query about using timestamps returned by SQL as 'factor' for split
I have a simple query as follows: "SELECT m_id,sale_date,YEAR(sale_date),WEEK(sale_date),return_type,DATEDIFF(return_date,sale_date) AS elapsed_time FROM risk_input" I can get, and view, all the data that that query returns. The question is, sale_date is a timestamp, and I need to call split to group this data by m_id and the week in which the sale occurred. Obviously, I would
2010 Jul 15
1
How do I combine lists of data.frames into a single data frame?
The data.frame is constructed by one of the following functions: funweek <- function(df) if (length(df$elapsed_time) > 5) { rv = fitdist(df$elapsed_time,"exp") rv$year = df$sale_year[1] rv$sample = df$sale_week[1] rv$granularity = "week" rv } funmonth <- function(df) if (length(df$elapsed_time) > 5) { rv =
2006 Jan 17
1
How to loop a Vobis sound ?
The sound file is played correctly for the first time, then when rewind to the initial position. then copy PCM to buffer, the OpenAL report an error. It seems like the OpenAL doesn't recognize the PCM data. The OpenAL error number : AL_INVALID_VALUE 0xA003 void Buffer::PCMData (ALuint id, ALenum eFormat, ALvoid *data, ALsizei size, ALsizei freq) { // Copy
2008 Jan 26
0
JRuby version of win32-api - initial try
Hi all, I''ve got a preliminary JRuby version of win32-api checked into CVS at the moment under win32-api/lib/win32/api.rb. I''ve also pasted it below. It doesn''t quite work right in that I can''t get it to modify the arguments in place in the API#call method. Take a look at the sample code at the very bottom to see what I mean. I haven''t even tried
2017 Jun 03
0
New var
Ii is difficult to provide useful help, because you have failed to read and follow the posting guide. In particular: 1. Plain text, not HTML. 2. Use dput() or provide code to create your example. Text printouts such as that which you gave require some work to wrangle into into an example that we can test. Specifically: 3. Have you gone through any R tutorials?-- it sure doesn't look like
2017 Jun 03
4
New var
Hi all, I have a data set with time interval and depending on the interval I want to create 5 more variables . Sample data below obs, Start, End 1,2/1/2015, 1/1/2017 2,4/11/2010, 1/1/2011 3,1/4/2006, 5/3/2007 4,10/1/2007, 1/1/2008 5,6/1/2011, 1/1/2012 6,10/15/2004,12/1/2004 First, I want get interval between the start date and end dates (End-start). obs, Start , end, datediff
2009 Apr 01
2
Matrix multiplication - code problem
Hi listers, I am having some trouble in a matrix multiplication... I have already checked some posts, but I didn't find my problem... I have the following code... But I am not getting the right multiplication... I checked the dimension and they are fine... id_y <- array(1:10,dim=c(2,1,5)) id_yt<-aperm(id_y,c(2,1,3)) m_id<-array(dim=c(dim(id_y)[1],dim(id_y)[1],dim(id_y)[3])) for (i in
2017 Jun 04
0
New var
# read.table is NOT part of the data.table package #library(data.table) DFM <- read.table( text= 'obs start end 1 2/1/2015 1/1/2017 2 4/11/2010 1/1/2011 3 1/4/2006 5/3/2007 4 10/1/2007 1/1/2008 5 6/1/2011 1/1/2012 6 10/5/2004 12/1/2004 ',header = TRUE, stringsAsFactors = FALSE) # cleaner way to compute D DFM$start <- as.Date( DFM$start, format="%m/%d/%Y" ) DFM$end
2017 Jun 03
2
New var
Thank you all for the useful suggestion. I did some of my homework. library(data.table) DFM <- read.table(header=TRUE, text='obs start end 1 2/1/2015 1/1/2017 2 4/11/2010 1/1/2011 3 1/4/2006 5/3/2007 4 10/1/2007 1/1/2008 5 6/1/2011 1/1/2012 6 10/5/2004 12/1/2004',stringsAsFactors = FALSE) DFM DFM$D =as.numeric(difftime(as.Date(DFM$end,format="%m/%d/%Y"),
2013 Jun 15
0
Calculate days with R
Hi, May be this helps: dat1<- read.table(text=" pbnr??????? dat? dep? dys? sop? ago? mis age female 1 10023 1994-02-21 0.75 1.00 0.50 0.50 0.75? 35????? 1 2 10023 1994-05-25 0.75 1.00 0.50 0.50 0.75? 35????? 1 3 10028 1994-02-01 2.00 1.75 3.00 0.50 1.50? 42????? 1 4 10028 1999-01-15 1.25 0.75 2.25 0.50 0.25? 42????? 1 5 10053 1994-03-16 2.50 0.75 1.25 0.50 1.25? 22????? 1 6 10053
2017 Jun 04
0
New var
Since the number of choices is small (6), how about this? Starting with Jeff's initial DFM: DFM <- structure(list(obs = 1:6, start = structure(c(16467, 14710, 13152, 13787, 15126, 12696), class = "Date"), end = structure(c(17167, 14975, 13636, 13879, 15340, 12753), class = "Date"), D = c(700, 265, 484, 92, 214, 57), bin = structure(c(6L, 3L, 5L, 1L, 3L, 1L), .Label
2010 Jul 12
2
exercise in frustration: applying a function to subsamples
>From the documentation I have found, it seems that one of the functions from package plyr, or a combination of functions like split and lapply would allow me to have a really short R script to analyze all my data (I have reduced it to a couple hundred thousand records with about half a dozen records. I get the same result from ddply and split/lapply: >
2017 Jun 04
2
New var
Thank you Jeff and All, Within a given time period (say 700 days, from the start day), I am expecting measurements taken at each time interval;. In this case "0" means measurement taken, "1" not taken (stopped or opted out and " -1" don't consider that time period for that individual. This will be compared with the actual measurements taken (Observed-
2006 Jun 19
2
Function hints
One of the recurring themes in the recent UserR conference was that many people find it difficult to find the functions they need for a particular task. Sandy Weisberg suggested a small idea he would like to see: a hints function that given an object, lists likely operations. I've done my best to implement this function using the tools currently available in R, and my code is included at the
2006 Jun 19
2
Function hints
One of the recurring themes in the recent UserR conference was that many people find it difficult to find the functions they need for a particular task. Sandy Weisberg suggested a small idea he would like to see: a hints function that given an object, lists likely operations. I've done my best to implement this function using the tools currently available in R, and my code is included at the
2010 Jul 22
1
How do I get rid of list elements where the value is NULL before applying rbind?
Here is the function that makes the data.frames in the list: funweek <- function(df) if (length(df$elapsed_time) > 5) { res = fitdist(df$elapsed_time,"exp") year = df$sale_year[1] sample = df$sale_week[1] mid = df$m_id[1] estimate = res$estimate sd = res$sd samplesize = res$n loglik = res$loglik aic = res$aic bic = res$bic chisq =
2006 Jun 20
1
[R] Function hints
[This is not about the feasibility of a "hints" function-- which would be incredibly useful, but perhaps very very hard to do-- but about some of the other documentation issues raised in Hadley's post and in Duncan's reply] WRTO documentation & code together: for several years, I've successfully used the 'mvbutils' package to keep every function definition &
2007 Jul 10
0
Plot dies with memory not mapped (segfault) (PR#9785)
Full_Name: Clay B Version: 2.5.0 (2007-04-23) OS: Solaris Nevada Build 55b Submission from: (NULL) (65.101.229.198) I find that running this script causes R to segfault reliably. However, running just for one system at a time (modifying the for loop updating iter to run just for a system at a time works). The system is a Sun W2100z with 12 GB of ram, and R segfaults using only around 360 MB of
2011 Mar 21
3
Computing row differences in new columns
Hi I have the following columns with dates and results, sorted by subject and date. I'd like to compute the differences in dates and results for each patient, based on the previous row. Obviously the last entry for each subject should be a NA. Which would be the best way to accomplished that ? I guess questions like that have been already answered a thousand times, so I apologize for