difference

SQL - Difference between odd/even columns into another column

ⅰ亾dé卋堺 提交于 2019-12-11 11:46:35
问题 I have a table which consists of the following data. Employee TimeRegister1 TimeRegister2 TimeRegister3 TimeRegister4 77 2014-04-01 11:51:43.000 2014-04-01 14:03:52.000 2014-04-01 14:17:01.000 2014-04-01 16:01:12.000 77 2014-04-03 09:48:33.000 2014-04-03 12:13:43.000 2014-04-03 12:22:27.000 2014-04-03 14:03:43.000 181 2014-04-02 08:24:34.000 2014-04-02 13:01:10.000 2014-04-02 14:30:31.000 2014-04-02 18:04:04.000 What I need is to write, on another column, the total calculated from the

Count days between two dates excluding weekends

守給你的承諾、 提交于 2019-12-11 04:50:00
问题 How can I find the difference between two dates in DB2 (excluding weekends)? Are there any functions that will do this in DB2? Or do I need to write a query myself? 回答1: There is AFAIK no such function. It is however easy to write a query that calculates this: with cal(d) as ( values date('2015-01-01') -- start_date union all select d + 1 day from cal where d < '2015-01-15' -- end_date ) select count(case when dayofweek(d) between 2 and 6 then 1 end) from cal; If you do a lot of these kind of

Difference between two lines ggplot2

不想你离开。 提交于 2019-12-11 04:28:22
问题 I wanted to add the difference between two lines to a ggplot2 . In this example, between the lines of the two groups defined by x2 . How can this be done? y=rbinom(100,1,.4) x1=rnorm(100, 3, 2) x2=rbinom(100, 1, .7) sub = data.frame(y=y, x1=x1, x2=x2) ggplot(sub, aes(x1, y, color = x2)) + stat_smooth(method = "glm", family = binomial, formula = y ~ poly(x1,3)) 回答1: There are two things you should change in your code. First, inside stat_smooth() use x and y and not the actual variable names

calculate the time difference for same column in Spotfire

拈花ヽ惹草 提交于 2019-12-11 01:54:01
问题 I am a beginner for Spotfire. I have a problem about the difference calculation for the some column value. A sample table could be like this: id timestamp state 1 7/1/2016 12:00:01 AM 1 2 7/1/2016 12:00:03 AM 0 3 7/1/2016 12:00:04 AM 1 4 7/1/2016 12:00:06 AM 0 5 7/1/2016 12:00:09 AM 1 6 7/1/2016 12:00:10 AM 0 7 7/1/2016 12:00:12 AM 1 I want to calculate the time difference for the timestamp when the state is 1, the final table I want to have is: id timestamp state time_diffence 3 7/1/2016 12

How to have a difference in week units between two days (even if they're close but belong to different weeks)

ⅰ亾dé卋堺 提交于 2019-12-11 00:17:03
问题 I make an example to be clear: if we speak of 2006/2007, the last day of 2006 was Sunday and the first of 2007 was Monday. According to Italy (but also other countries), they belong to different weeks. How can I obtain this information in R? If I do: difftime(as.Date("2007-01-01"),as.Date("2006-12-31"),units="weeks") I get: 0.1428571 ...but I would like to know some way to get 1 (as they differ of 1 week) 回答1: Your problem is that Monday should be the first day of the week. R packages usually

What is difference index.html vs index.jsp? [closed]

▼魔方 西西 提交于 2019-12-10 11:14:53
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 5 years ago . One URL ends in 'index.html'. Another URL ends in 'index.jsp'. Explain how these two requests result in very different behavior by the server. 回答1: JSP is a file extension for Java Server Pages file format. A JSP is an HTML page containing a reference to Java servlets, or, java

Java User Input and Difference between readInt and nextInt?

会有一股神秘感。 提交于 2019-12-09 03:59:10
问题 What is wrong with this? import java.io.*; class TUI{ public static void main(String[] args) { System.out.println("Enter the two numbers:"); int n1=readInt("Enter n1:"); int n2=readInt("Enter n2:"); int total=n1+n2; System.out.println("Total is =" + total+"."); } } Getting these errors Day2.java:5: error: cannot find symbol int n1=readInt("Enter n1:"); ^ symbol: method readInt(String) location: class TUI Day2.java:6: error: cannot find symbol int n2=readInt("Enter n2:"); ^ symbol: method

(git) diff output relative path?

我与影子孤独终老i 提交于 2019-12-08 15:26:54
问题 I need to get some diffs in my repo that are not relative to the base of the repo, but instead relative to a given base or given path. By default I get: git diff diff --git a/path/to/file b/path/to/file index 0cc125e..9bf911e 100644 --- a/path/to/file +++ b/path/to/file But what I want is something like: git diff --prefix=/new/path/to diff --git a/new/path/to/file b/new/path/to/file index 0cc125e..9bf911e 100644 --- a/new/path/to/file +++ b/new/path/to/file I have looked over the --relative

r compare column types between two dataframes

拜拜、爱过 提交于 2019-12-08 15:09:29
This may be a bad question because I am not posting any reproducible example. My main goal is to identify columns that are of different types between two dataframe that have the same column names. For example df1 Id Col1 Col2 Col3 Numeric Factor Integer Date df2 Id Col1 Col2 Col3 Numeric Numeric Integer Date Here both the dataframes (df1, df2) have same column names but the Col1 type is different and I am interested in identifying such columns. Expected output. Col1 Factor Numeric Any suggestions or tips on achieving this ?. Thanks Try this: compareColumns <- function(df1, df2) { commonNames <

How to get the difference between next and previous row in an R time series?

流过昼夜 提交于 2019-12-08 07:53:36
问题 I have a quite large time series comprising around 14k observations of 4 variables ( date , x , y , z ). How can I, (contrary to the function diff( df$vector, lag = 1) which computes the difference between the current value ( t ) and the previous one ( t-1 )), calculate for each value the difference between the next value ( t+1 ) and the previous value ( t-1 )? 回答1: So, to understand the request... Generate some data: set.seed(11) a = sample(1:10, 10) Data is given as: 3 1 5 9 7 8 6 4 2 10