File size: 1,758 Bytes
c633a0a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
[
  {
    "id": 0,
    "page": 7,
    "bounding_box": [
      72.83499908447266,
      146.5009765625,
      503.1652038574219,
      231.781005859375
    ],
    "latex_content": "\\begin{table}\n  \\centering\n  \\begin{tabular}{|c|p{5cm}|p{5cm}|}\n  \\hline\n  Concept & SQL & \\R (\\cmd{dplyr}) \\\\\n  \\hline\n  Filter by rows \\& columns \n    & \\cmd{SELECT col1, col2 FROM $a$ WHERE col3 = 'x'} \n    & \\cmd{select(filter($a$, col3 == \"x\"), col1, col2)} \\\\\n  \\hline\n  Aggregate by rows \n    & \\cmd{SELECT id, sum(col1) as total FROM $a$ GROUP BY id} \n    & \\cmd{summarise(group\\_by($a$, id), total = sum(col1))} \\\\\n%    & \\cmd{ddply($a$[,c(id, col1)], $\\sim$ id, sum)} \\\\\n  \\hline\n  Combine two tables \n    & \\cmd{SELECT * FROM $a$ JOIN $b$ ON a.id = b.id} \n    & \\cmd{inner\\_join(x=$a$, y=$b$, by=\"id\"))} \\\\\n  \\hline\n  \\end{tabular}\n  \\caption{Conceptually analogous SQL and \\R commands. Suppose $a$ and $b$ are SQL tables or \\R \\cmd{data.frame}s}\n  \\label{tab:sql-r}\n\\end{table}",
    "extracted_content": [
      [
        "Concept",
        "SQL",
        "R (dplyr)"
      ],
      [
        "Filter by rows & columns",
        "SELECT col1, col2 FROM a\nWHERE col3 = \u2019x\u2019",
        "select(filter(a, col3 ==\n\"x\"), col1, col2)"
      ],
      [
        "Aggregate by rows",
        "SELECT id, sum(col1) as\ntotal FROM a GROUP BY id",
        "summarise(group by(a, id),\ntotal = sum(col1))"
      ],
      [
        "Combine two tables",
        "SELECT * FROM a JOIN b ON\na.id = b.id",
        "inner join(x=a, y=b,\nby=\"id\"))"
      ]
    ],
    "similarity_score": 0.815,
    "table_image": "images/1503.05570v1/table_0.png",
    "page_image": "pages/1503.05570v1/page_7.png"
  }
]