sporfire: calculate the avg per 15 minutes - average

I am a beginner for Spotfire. I have a problem about the average calculation per each 15 mins by calculated column. A sample table could be like this:
id time-stamp value
1 7/1/2016 12:01:01 AM 1.1
2 7/1/2016 12:05:03 AM 0.9
3 7/1/2016 12:08:04 AM 1.2
4 7/1/2016 12:09:06 AM 0.8
5 7/1/2016 12:12:09 AM 0.4
6 7/1/2016 12:14:10 AM 0.6
7 7/1/2016 12:15:12 AM 1.3
8 7/1/2016 12:18:04 AM 1.4
9 7/1/2016 12:21:06 AM 0.7
10 7/1/2016 12:24:09 AM 1.7
11 7/1/2016 12:31:10 AM 0.5
12 7/1/2016 12:39:12 AM 1.3
I want to calculate the avg value for each 15 mins, the table is already ordered by time.
the final table I want to have is:
time-stamp Avg
7/1/2016 12:00:00 AM 0.83333
7/1/2016 12:15:00 AM 1.275
7/1/2016 12:30:00 AM 0.9
for example, for the first number 0.83333 =(1.1+0.9+1.2+0.8+0.4+0.6)/6
it seems that I should identify an expression of the calculation for a new table, but how to calculate the avg. for each 15 mins. somebody could help me ?
thanks for your help :)
note: thanks for code #ksp585, but after this, i still have a small problem for it, the cross table just shows the times-stamp until 9:45 PM

# ZAWD - I have created a calculated column which groups the timestamp into 4 quarters for an hour. Used this column in the cross table below to calculate average time.
timestamp grouping expression (time_interval):
case
when (DatePart("minute",[time-stamp])>0) and (DatePart("minute",[time-stamp])<15) then Date([time-stamp]) & " " & Hour([time-stamp]) & ":00" & ":00"
when (DatePart("minute",[time-stamp])=15) and (DatePart("second",[time-stamp])>0) then Date([time-stamp]) & " " & Hour([time-stamp]) & ":15" & ":00"
when (DatePart("minute",[time-stamp])>15) and (DatePart("minute",[time-stamp])<30) then Date([time-stamp]) & " " & Hour([time-stamp]) & ":15" & ":00"
when (DatePart("minute",[time-stamp])=30) and (DatePart("second",[time-stamp])>0) then Date([time-stamp]) & " " & Hour([time-stamp]) & ":30" & ":00"
when (DatePart("minute",[time-stamp])>30) and (DatePart("minute",[time-stamp])<45) then Date([time-stamp]) & " " & Hour([time-stamp]) & ":30" & ":00"
when (DatePart("minute",[time-stamp])=45) and (DatePart("second",[time-stamp])>0) then Date([time-stamp]) & " " & Hour([time-stamp]) & ":45" & ":00"
when (DatePart("minute",[time-stamp])>45) and (DatePart("minute",[time-stamp])<=60) then Date([time-stamp]) & " " & Hour([time-stamp]) & ":45" & ":00"
when (DatePart("minute",[time-stamp])=0) and (DatePart("second",[time-stamp])>0) then Date([time-stamp]) & " " & Hour([time-stamp]) & ":00" & ":00"
else null end
Final Table:
Tested with a different datetime format:

Related

\hline issue with LaTex when importing table from different .tex file into a tabular environment

I'm having an issue where at certain points using the \hline function creates an error and instead displays the word "height" where there should be a line. This is happening only when I use an /hline immediately after using a \input{".../filename.tex"} command in a tabular environment. Interestingly, though, adding an \hline to the last row of the file I am importing produces an \hline properly. Does anyone have an idea why this may be the case and what I can do to fix it so that I can add the \hline to the main file and not the files I'm importing. Note that I use TexMaker and MiKTeX
Here are some examples of my code that doesn't work:
\documentclass{12pt, english}{article}
\usepackage{geometry}
\usepackage{caption}
\usepackage{tocvsec2}
\usepackage{graphicx}
\usepackage{multirow}
\usepackage{tabularx}
\usepackage{subfloat}
\usepackage{subcaption}
\usepackage{enumitem}
\usepackage{tabularx}
\usepackage{tabulary}
\usepackage{tabu}
\usepackage{titlesec}
\usepackage{tocloft}
\begin{document}
\begin{table}
\caption{Caption} \label{tab:label} \centering
\begin{tabular}{lccc}
\hline
\import{".../filename.tex"}
\hline
\end{tabular}
\begin{minipage}{0.95}
Notes are here
\end{minipage}
\end{table}
\end{document}
where filename.tex looks like this (with nothing else):
& Mean & SD & N \\
\midrule
Var 1 & 1 & 0 & 1000 \\
Var 2 & 1 & 0 & 1000 \\
Var 3 & 1 & 0 & 1000 \\
Var 4 & 1 & 0 & 1000 \\
Var 5 & 1 & 0 & 1000 \\
When I move the last \hline to the end of filname.tex, however, it works fine.
You can use the same trick as in https://tex.stackexchange.com/a/50700/36296
Other problems:
the syntax \documentclass{12pt, english}{article} is wrong
the booktabs package is missing
missing unit in \begin{minipage}{0.95}
you really, really, really shouldn't use the tabu package, it is more or less completely broken
don't load the same package multiple times
\documentclass[12pt, english]{article}
\usepackage{geometry}
\usepackage{caption}
\usepackage{tocvsec2}
\usepackage{graphicx}
\usepackage{multirow}
%\usepackage{tabularx}
\usepackage{subfloat}
\usepackage{subcaption}
\usepackage{enumitem}
\usepackage{tabularx}
\usepackage{tabulary}
%\usepackage{tabu}
\usepackage{titlesec}
\usepackage{tocloft}
\usepackage{booktabs}
\begin{filecontents*}[overwrite]{test.tex}
& Mean & SD & N \\
\midrule
Var 1 & 1 & 0 & 1000 \\
Var 2 & 1 & 0 & 1000 \\
Var 3 & 1 & 0 & 1000 \\
Var 4 & 1 & 0 & 1000 \\
Var 5 & 1 & 0 & 1000 \\
\end{filecontents*}
\makeatletter
\newcommand\primitiveinput[1]
{\##input #1 }
\makeatother
\begin{document}
\begin{table}
\caption{Caption} \label{tab:label} \centering
\begin{tabular}{lccc}
\hline
\primitiveinput{test}
\hline
\end{tabular}
\begin{minipage}{0.95cm}
Notes are here
\end{minipage}
\end{table}
\end{document}

An issue with argument "sortv" of function seqIplot()

I'm trying to plot individual sequences by means of function seqIplot() in TraMineR. These individual sequences represent work trajectories, completed by former school's graduates via a WEB questionnaire.
Using argument "sortv", I'd like to sort my sequences according to the order of the levels of one covariate, the year of graduation, named "PROMO".
"PROMO" is a factor variable contained in a data frame named "covariates.seq", gathering covariates together:
str(covariates.seq)
'data.frame': 733 obs. of 6 variables:
$ ID_SQ : Factor w/ 733 levels "1","2","3","5",..: 1 2 3 4 5 6
7 8 9 10 ...
$ SEXE : Factor w/ 2 levels "Féminin","Masculin": 1 1 1 1 2 1
1 2 2 1 ...
$ PROMO : Factor w/ 6 levels "1997","1998",..: 1 2 2 4 4 3 2 2
2 2 ...
$ DEPARTEMENT : Factor w/ 10 levels "BC","GCU","GE",..: 1 4 7 8 7 9
9 7 7 4 ...
$ NIVEAU_ADMISSION: Factor w/ 2 levels "En Premier Cycle",..: NA 1 1 1 1
1 NA 1 1 1 ...
$ FILIERE_SECTION : Factor w/ 4 levels "Cursus Classique",..: NA 4 2 NA
1 1 NA NA 4 3 ..
I'm also using "SEXE", the graduates' gender, as a grouping variable. To plot the individual sequences so, my command is as follows:
seqIplot(sequences, group = covariates.seq$SEXE,
sortv = covariates.seq$PROMO,
cex.axis = 0.7, cex.legend = 0.7)
I expected that, by using a process time axis (with the year of graduation as sequence-dependent origin), sorting the sequences according to the order of the levels of "PROMO" would give a plot with groups of sequences from the longest (for the older graduates) to the shortest (for the younger graduates).
But I've got an issue: in the output plot, the sequences don't appear to be correctly sorted according to the levels of "PROMO". Indeed, by using "sortv = covariates.seq$PROMO" as in the command above, the plot doesn't show groups of sequences from the longest to the shortest, as expected. It looks like the plot obtained without using the argument "sortv" (see Figures below).
Without using argument "sortv"
Using "sortv = covariates.seq$PROMO"
Note that I have 733 individual sequences in my object "sequences", created as follows:
labs <- c("En poste","Au chômage (d'au moins 6 mois)", "Autre situation
(d'au moins 6 mois)","En poursuite d'études (thèse ou hors
thèse)", "En reprise d'études / formation (d'au moins 6 mois)")
codes <- c("En poste", "Au chômage", "Autre situation", "En poursuite
d'études", "En reprise d'études / formation")
sequences <- seqdef(situations, alphabet = labs, states = codes, left =
NA, right = "DEL", missing = NA,
cnames = as.character(seq(0,7400/365,1/365)),
xtstep = 365)
The values of the covariates are sorted in the same order as the individual sequences. The covariate "PROMO" doesn't contain any missing value.
Something's going wrong, but what?
Thank you in advance for your help,
Best,
Arnaud.
Using a factor as sortv argument in seqIplot works fine as illustrated by the example below:
sdc <- c("aabbccdd","bbbccc","aaaddd","abcabcab")
sd <- seqdecomp(sdc, sep="")
seq <- seqdef(sd)
fac <- factor(c("2000","2001","2001","2000"))
par(mfrow=c(1,3))
seqIplot(seq, with.legend=FALSE)
seqIplot(seq, sortv=fac, with.legend=FALSE)
seqlegend(seq)

Text file processing in Matlab

I have a text output from a program with a set format. I need to parse ~200 of them to extract an information. I tried in MATLAB with 'textscan' but did not work. Following is the input:
MOTIFS SUMMARY:
1) TTATAGCCGC (GCGGCTATAA) 1.986
2) AAACCGCCTC (GAGGCGGTTT) 1.865
DETAILED RESULTS:
1) TTATAGCCGC (GCGGCTATAA) 1.986
Matrix: MAT1 TTATAGCCGC
A 0.1249 0.177 0.7364 0.1189 0.7072 0.1149 0.09858 0.1096
C 0.0899 0.07379 0.1136 0.1298 0.08662 0.1293 0.7528 0.721
G 0.06828 0.1284 0.07195 0.1031 0.1352 0.6708 0.05556 0.0713
T 0.7169 0.6209 0.07802 0.6482 0.07096 0.08492 0.09305 0.09804
OCCURRENCES:
>GENE_1 1 TTATAGCCGC 1 561 +
>GENE_2 24 TAATAGCCGC 0.928699 762 -
>GENE_3 10 ATATAGCCGC 0.904905 185 -
>GENE_1 7 TTATAGCAGC 0.901785 726 +
**********
2) AAACCGCCTC (GAGGCGGTTT) 1.865
Matrix: MAT2 AAACCGCCTC
A 0.653 0.7401 0.7763 0.1323 0.09619 0.09134 0.07033 0.1383
C 0.1163 0.07075 0.09441 0.749 0.6347 0.1132 0.6559 0.6982
G 0.09136 0.09402 0.07385 0.04209 0.1799 0.7332 0.1241 0.07568
T 0.1393 0.09518 0.05541 0.07659 0.08921 0.06234 0.1497 0.08786
OCCURRENCES:
>GENE_1 21 AAACCGCCTC 1 963 +
>GENE_2 14 AAACGGCCTC 0.928198 212 +
>GENE_2 8 AAACCGTCTC 0.92009 170 +
>GENE_4 3 TAACCGCCTC 0.918883 370 +
**********
I am trying to count the unique() occurrence under each motif and add it to the MOTIF SUMMARY and a final average of them. My expected output is:
MOTIFS SUMMARY:
1) TTATAGCCGC (GCGGCTATAA) 1.986 3
2) AAACCGCCTC (GAGGCGGTTT) 1.865 3
AVERAGE OCCURRENCE: 3
For motif 1, unique occurrence is 3 (GENE_1, GENE_2, GENE_3). Similarly for motif 2, it is again 3 (GENE_1, GENE_2, GENE_4)
How can I use OCCURRENCES and ****** as blocks ? so that, I can regexp GENE_x to store it and count.
Kindly help.
Thanks,
AP
You better try to change the original text file so that it will be legal matlab m file code, then just use 'eval' function to run it .
Most of the job will be to find where to insert '=' and '[' ']' and '%' for ignore parts.
If all files are identical in format than it will be easy.

why coloumn not updating using in pl/sql

i am trying to calculate the cgpa of a student from his term gpa.
and store the gpa value in gpa coloumn in the result table.
my code link:http://paste.ubuntu.com/21677789/.
finally it's showing the output:
hello term1
1307001 2 1 2
hello year2
hello term1
1307001 3 1 1.7
hello year3
hello roll1307001
hello term1
1307002 2 1 1.71315789473684210526315789473684210526
hello year2
hello term1
1307002 3 1 1.76315789473684210526315789473684210526
hello year3
hello roll1307002
PL/SQL procedure successfully completed.
and gpa value is not updated in result value..why value of tt showing too long ...help please..thanks in advance.

VBScript in IBM Personal Communications, Register current date and time

This is a bit complicated to explain but I sure will do my best!
I want to register the current time and date "Year,Week,day + Time", in my program IBM Personal Communications (Session A). I have to use a .MAC extension for the final file in order for the program to read it.
This is the code that I have at the moment:
[PCOMM SCRIPT HEADER]
LANGUAGE=VBSCRIPT
DESCRIPTION=
[PCOMM SCRIPT SOURCE]
OPTION EXPLICIT
autECLSession.SetConnectionByName(ThisSessionName)
REM This line calls the macro subroutine
subSub1_
sub subSub1_()
autECLSession.autECLOIA.WaitForAppAvailable
autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLPS.SendKeys "151441652 " **<--This is where the date has to appear**
autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLPS.SendKeys "[enter]"
autECLSession.autECLPS.WaitForAttrib 12,1,"00","3c",3,10000
autECLSession.autECLPS.Wait 3401
autECLSession.autECLOIA.WaitForAppAvailable
autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLPS.SendKeys "[pf12]"
end sub
autECLSession.autECLPS.SendKeys "151441652 " <--- The final values must appear here in the same order. The numbers have been entered manually by me. So what I essentially need the final program to do is to recognize the date and enter them manually.
This is what the numbers stand for:
15 = The year 2015
14 = The current week, the date right now is 02-04-2015 which is Week 14
4 = Day 4 of the week. thursday
1652 = Current time, I need the time to be a 24hour clock.
DatePart() can do all of this.
autECLSession.autECLPS.SendKeys _
Right(DatePart("yyyy", Now()), 2) & _
Right("0" & DatePart("ww", Now()), 2) & _
DatePart("w", Now()) & _
Right("0" & DatePart("h", Now()), 2) & _
Right("0" & DatePart("n", Now()), 2)
Take note of the optional FirstDayOfWeek and FirstWeekOfYear parameters, test your edge cases and set those parameters accordingly for the relevant calls.