Question: I have this query and I'd like to *select the **inverse** of this query* (the ones which are not concerned.

```
SELECT*
FROM input1
LEFT OUTER JOIN (
    SELECT MAX(Ref) AS Ref, Nomlatin, Lieudit, Commune
    FROM input1
    GROUP BY Nomlatin, Lieudit, Commune
) as t1 
ON input1.Ref = t1.Ref
WHERE t1.Ref IS NULL

```

I have already searched for answers to this question but I didn't succeed to use the `NOT IN`.

If someone can help me, it would be great.

Thanks

Answer: 
I'm not quite sure of the broader context, in particular whether you need to use `fread()`, but

```
s <- scan(text=master, sep="|", what=character())

```

works well, and fast (0.1 seconds).
I would like to add the final solution, which was implemented in `fread` <https://github.com/Rdatatable/data.table/issues/1423>.
Perhaps this also saves others a bit of time.

So the solution becomes simpler:

```
library(data.table)

name <- "https://www.sec.gov/Archives/edgar/full-index/2016/QTR1/master.idx"
master <- readLines(name, 1000)
master <- master[grep("SC 13(D|G)", master)]
master <- paste(master, collapse = "\n")
master_table <- fread(text = master, sep = "|")

```