I need to merge 6 similar tab-delimited tables with 5 columns, as shown in the example below:
file s1
s1
A 4
B 3
C 6
D 3
file s2
s2
A 8
B 5
E 4
F 3
G 6
file s3
s3
A 3
B 6
C 9
E 9
F 6
G 8
H 4
output
s1 s2 s3
A 4 8 3
B 3 5 6
C 6 - 9
D 3 - -
E - 4 9
F - 3 6
G - 6 8
H - - 4
And so on. The goal is to merge similar 'letters' in a way, that each values from different files (if they are present) are added to the appropriate columns (if not present then mark it as '-' or '0').
I've tried join and awk, but I did not succeeded and I think it requires more advanced approach.
Related
I have thousand data google sheet to copy another sheet transpose with separate colomn
Sheet1
Input
A B C D E F
1 A1 1 2 3 4 G
2 A2 4 5 6 5 H
3 B3 7 8 9 10 I
4 C1 11 12 13 14 I
Sheet2
Result
A B C D E
1 A1 1 2 G
2 3 4
3 A2 4 5 H
4 6 5
5 B3 7 8 I
6 9 10
7 C1 11 12 I
8 13 14
I use manual methode to sheet 2 cell
'A1= sheet1!A1
'B1= sheet1!B1
'C1= sheet1!C1
'D1= sheet1!F1
Can any one help for loop formula or java apps script.
Loop Formula or apps script for copy of that data
I have a Dataframe like this
Sys_id
Id
A
4
A
5
A
6
A
100
A
2
A
3
A
4
A
5
A
6
A
7
B
100
B
2
B
3
B
4
B
5
B
6
B
100
I want to fetch the Id's between Id==100 how can I get that by partition using sys_id
I want an output like this
Sys_id
Id
A
2
A
3
A
4
A
5
A
6
A
7
B
2
B
3
B
4
B
5
B
6
I tried using
Windowspec=Window.partitionBy("sys_id").orderBy("timestamp")
df=df.withColum("id",(df.id==100).cast("int")
df=df.withColumn("next_id",lead('id',1).over(Windowspec))
Is there any alternative way to get the answer?
1A
a b c
1 1 6
1 1 7
2 1 8
2 2 2
2 2 9
B
a b c
1 1 7
2 2 9
I want to filter out a subset of A
a b c
1 1 6
2 2 2
I am intend to join two tables by group by column a, b
such that to select the value in column c is less than the c value in table B, which is the desired subset.
But don't know how to implement this.
Try this:
SELECT A.* FROM A INNER JOIN B
ON A.a=B.b AND A.c<B.c;
See MySQL Join Made Easy tutorial.
I have many files, but I can not find how to bind column.
For example, files are followed
[1.txt]
ID Score
A 1
B 2
C 3
D 4
[2.txt]
ID Score
A 2
B 2
C 3
D 4
[3.txt]
ID Score
A 4
B 4
C 5
D 3
I want to make
A 1 2 4
B 2 2 4
C 3 3 5
D 4 4 3
You could use cbind() as follows:
df_final <- cbind(cbind(df1, df2["Score"]), df3["Score"])
df_final
ID Score Score Score
1 A 1 2 4
2 B 2 2 4
3 C 3 3 5
4 D 4 4 3
Note that if you were trying to match IDs between data frames which did not coincidentally have the order you want, then you would be asking more for a database style join. In this case, R offers the merge() function from baseR.
Demo
I have two different datasets source and destination datsets
Source Dataset
Type A B C D E F G
X 1 2 3 4 5 6 7
Y 2 1 3 5 6 7 8
Z 3 4 5 6 7 8 9
Destination Dataset
Type A B C D E F G
X 0 2 3 6 3 7 9
Y 1 1 5 5 4 8 0
Z 2 3 4 4 5 9 9
Is it possible two create a report in the following format?
Type A B C D E F G
Source X 1 2 3 4 5 6 7
Destin X 0 2 3 6 3 7 9
Source Y 2 1 3 5 6 7 8
Destin Y 1 1 5 5 4 8 0
Source Z 3 4 5 6 7 8 9
Destin Z 2 3 4 4 5 9 9
Handle this in SQL itself with query like this:
SELECT * FROM
(SELECT 'Source' AS myField, Type, A, B, C, D, E, F, G
FROM Table1 T1
UNION ALL
SELECT 'Destination' AS myField, Type, A, B, C, D, E, F, G
FROM Table1 T2 ) A
ORDER BY myField Desc, Type
It will be better way instead of handling it in SSRS.
To solve it in SSRS, you would need to know if the Types in both the datasets are mutually exclusive or not. If there are Types which exists in one but not in other, then you would have to do lot of hardcoding. All changes in the input data you would need to change the report. If the types in both dataset are not mutually exclusive then you might be able to use Lookup functions.
You can use Lookup functionality,
OR instead of doing the join in SSRS it's better to do this is in SQL.