Total members 11678 |It is currently Sat Nov 25, 2017 3:12 am Login / Join Codemiles

Java

C/C++

PHP

C#

HTML

CSS

ASP

Javascript

JQuery

AJAX

XSD

Python

Matlab

R Scripts

Weka





The following R script subtracts two dates and get the difference in days. The dates are in the String format. Thus, the R script has to use date format to convert the strings into dates.

Code:



diff
=as.Date(strptime("2004-02-03""%Y-%m-%d"))-as.Date(strptime("2006-02-03""%Y-%m-%d"))
diffNum=as.numeric(diff)
print(
diff);

 





Author:
Mastermind
User avatar Posts: 2707
Have thanks: 74 time
Post new topic Reply to topic  [ 1 post ] 

  Related Posts  to : Get Difference in days between two dates as a number
 find the difference between dates in asp.net     -  
 Comparing Dates in Java     -  
 DYNAMIC DATES IN MYSQL     -  
 Formatting dates in mysql     -  
 convert integer number to octal,hexadecimal number systems     -  
 Validation of php drop down menu of months,days and years     -  
 convert octal number to decimal number     -  
 convert decimal number to octal number     -  
 difference between the >> and >>> operators     -  
 Difference between Externalization and Serialzation     -  



Topic Tags

R Analysis







Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
All copyrights reserved to codemiles.com 2007-2011
mileX v1.0 designed by codemiles team