search for: datediff

Displaying 17 results from an estimated 17 matches for "datediff".

2017 Jun 03
4
New var
...o 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 1,2/1/2015, 1/1/2017, 700 2,4/11/2010, 1/1/2011, 265 3,1/4/2006, 5/3/2007, 484 4,10/1/2007, 1/1/2008, 92 5,6/1/2011, 1/1/2012, 214 6,10/15/2004,12/1/2004,47 Second. I want create 5 more variables t1, t2, t3, t4 and t5 The value of each variable is defined as follows if datediff < 100 the...
2017 Jun 03
0
New var
...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 > 1,2/1/2015, 1/1/2017, 700 > 2,4/11/2010, 1/1/2011, 265 > 3,1/4/2006, 5/3/2007, 484 > 4,10/1/2007, 1/1/2008, 92 > 5,6/1/2011, 1/1/2012, 214 > 6,10/15/2004,12/1/2004,47 > > Second. I want create 5 more variables t1, t2, t3, t4 and t5 > The value of each variable is d...
2017 Jun 03
2
New var
...>> 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 >> 1,2/1/2015, 1/1/2017, 700 >> 2,4/11/2010, 1/1/2011, 265 >> 3,1/4/2006, 5/3/2007, 484 >> 4,10/1/2007, 1/1/2008, 92 >> 5,6/1/2011, 1/1/2012, 214 >> 6,10/15/2004,12/1/2004,47 >> >> Second. I want create 5 more variables t1, t2, t3, t4 and t5 >...
2017 Jun 04
0
New var
...>> 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 >>> 1,2/1/2015, 1/1/2017, 700 >>> 2,4/11/2010, 1/1/2011, 265 >>> 3,1/4/2006, 5/3/2007, 484 >>> 4,10/1/2007, 1/1/2008, 92 >>> 5,6/1/2011, 1/1/2012, 214 >>> 6,10/15/2004,12/1/2004,47 >>> >>> Second. I want create 5 more variab...
2017 Jun 04
2
New var
...gt;>>> 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 >>>> 1,2/1/2015, 1/1/2017, 700 >>>> 2,4/11/2010, 1/1/2011, 265 >>>> 3,1/4/2006, 5/3/2007, 484 >>>> 4,10/1/2007, 1/1/2008, 92 >>>> 5,6/1/2011, 1/1/2012, 214 >>>> 6,10/15/2004,12/1/2004,47 >>>> >>>> Sec...
2017 Jun 04
0
New var
...gt;>>> 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 >>>> 1,2/1/2015, 1/1/2017, 700 >>>> 2,4/11/2010, 1/1/2011, 265 >>>> 3,1/4/2006, 5/3/2007, 484 >>>> 4,10/1/2007, 1/1/2008, 92 >>>> 5,6/1/2011, 1/1/2012, 214 >>>> 6,10/15/2004,12/1/2004,47 >>>> >>>> Sec...
2011 Mar 21
3
Computing row differences in new columns
...ased 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 asking one more time. Thanks Roberto SUBJECT Date Result DateDiff ResultDiff 10751 22-Jul-03 3.5 10751 13-Feb-04 1.3 10751 20-Aug-04 1.6 10751 08-Mar-05 1.7 10751 30-Aug-05 1.6 10751 21-Feb-06 1.3 10751 31-Aug-06 1.2 10751 27-Feb-07 1.5 10751 29-Aug-07 1 10752 29-Jul-03 5.9 10752 24-Feb-04 5 10752 25-Aug-04 3.6 10752 11-Mar-0...
2013 Jun 15
0
Calculate days with R
...5 1.25 0.50 1.25? 22????? 1 6 10053 1994-09-23 3.25 1.25 1.25 0.75 2.25? 22????? 1 ",sep="",header=TRUE,stringsAsFactors=FALSE) dat1$dat<- as.Date(dat1$dat) ?with(dat1,tapply(dat,list(pbnr),FUN=diff)) #10023 10028 10053 #?? 93? 1809?? 191 library(plyr) ?ddply(dat1,.(pbnr),mutate,Datediff=diff(dat)) ?#? pbnr??????? dat? dep? dys? sop? ago? mis age female Datediff #1 10023 1994-02-21 0.75 1.00 0.50 0.50 0.75? 35????? 1?????? 93 #2 10023 1994-05-25 0.75 1.00 0.50 0.50 0.75? 35????? 1?????? 93 #3 10028 1994-02-01 2.00 1.75 3.00 0.50 1.50? 42????? 1???? 1809 #4 10028 1999-01-15 1.25 0.7...
2005 Oct 28
4
find_by_sql column types
...by_sql. The problem I¹m encountering is that all computed columns from MySQL come back as type string. E.g., def self.find_averages(domain_id) if @@domain_average return @@domain_average else @@domain_average = MyDomain.find_by_sql(["select avg(latency) as latency, avg(datediff(session_end, session_start)) as session_duration from live_logs where domain_id=?"], domain_id])[0] end end The problem is that I¹m using a lot of to_f conversions because type coercions are not happening as I would have expected. Again, for example: foo = MyDomain.find_averages(1) bar =...
2009 Sep 02
4
diff of two timestamps
...data with the read.csv-function: myObj <- read.csv("file.csv",header=TRUE,sep=";"). I have then tried unsuccessfully to convert the data to time format (e.g. using the strptime function like date1 <- strptime(myObj[0],format="%H:%M:%S")) to be able to perform a datediff operation. I would be very grateful if anybody could give me some assistance. Thanks in advance, Ieyasu -- View this message in context: http://www.nabble.com/diff-of-two-timestamps-tp25267603p25267603.html Sent from the R help mailing list archive at Nabble.com.
2010 Jul 21
0
One problem with RMySQL and a query that returns an empty recordset
...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 i...
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 = fitdis...
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 normally need both YE...
2007 Jul 10
0
Plot dies with memory not mapped (segfault) (PR#9785)
...userTime<-NULL failures<-NULL # Date Clamp Limits Us To The Middle 80% Of All Data usageDateClamp<-paste(" WHERE FROM_UNIXTIME(submit_time) >= (SELECT ", "FROM_UNIXTIME(MIN(submit_time)) + INTERVAL 0.10*", "DATEDIFF(MAX(FROM_UNIXTIME(submit_time)),MIN(FROM_UNIXTIME(", "submit_time))) DAY FROM ",systems[iter],") AND FROM_UNIXTIME(", "submit_time) <= (SELECT FROM_UNIXTIME(MAX(submit_time)) - ", "INTERVAL 0.10*DATEDIFF(MAX(...
2010 May 14
2
operations between two aggregated data frames?
Hi All, I've come up with a solution for this problem that relies on a for loop, and I was wondering if anybody had any insight into a more elegant method: I have two data frames, each has a column for categorical data and a column for date. What I'd like to do, ideally, is calculate the number of days between all pairs of dates in data frame 1 and data frame 2 (*but only for members
2008 Mar 06
1
AEL - SQL and TIMEDIFF()
Hello list, I'm having some problem integrating the SELECT TIMEDIFF() and SELECT DATEDIFF() in my code. The syntax I'm using works without any problems if I run them directly from the MySQL Client, but from the Asterisk Dialplan it just wont work. Is there a limitation in the MySQL() application for the Asterisk dialplan that produces this error? <CODE> context testsql { s...
2006 Jan 22
23
calculate users age
i know it''s probably really simple, how do i work out someone''s age if i have their d.o.b. stored as a date in my db. cheers -- Posted via http://www.ruby-forum.com/.