Question: Obligatory system setup in case it helps :
Running Windows 10, R 3.2.3
Intel Core i7 2600k.
16 GB RAM. R is set to have access to as much RAM as it wants.

Hello!

I have a few hundred files, each with a data frame of size Nx29 or Nx31.

I am combining ~4 columns that overlap in each of these data frames.
So ID1, ID2, Date, Text. I am sorting by date.

So the problem is, these N's can be a few dozen lines in some files, and a few million lines in other files.

My original idea was

```
Create a blank data frame
Loop -->
    Open a file
    Add that file to the Dataframe.
    Remove any duplicate rows (they happen semi-frequently)
    Open the next file.

```

However, even doing that results in my data frame getting too large and running out of memory.

I would consider writing to file, but that could be problematic, because let's say I 

```
Read file
Write to file
Open next file
Repeat.

```

Then once I have everything in 1 massive file, I likely won't be able to load that into R, since if the individual components wont all fit in memory at once, then likely the combined won't either.

However, I want it all sorted by date, and each file can contain ~45 days worth of data or so, so it's hard to see a way to do this.

So how can I effectively get all of my data together to be able to sort it without blowing R up?

Thanks!

Answer: 
I ended up setting a CIFilter called "CIFalseColor" over the button in the IB and then at runtime I control the color with : 

```
button.contentFilters[0].setValue(myCIColor, forKey: "inputColor1")

```

This works if your image is white, inputColor2 controls the black, so I presume that a greyscale image would be a mix between the two.

It's not the best because it hurts the performance of the app but it will do until somebody finds a better way.
If you're using a Core Graphics context, then you can specify the Blend Mode for overlapping objects using `CGContextSetBlendMode`. This can take values representing each of the standard Blend modes in the PDF Specification, e.g. Difference, Multiply, Overlay, Screen, etc. 

Then use `CGContextFillRect` to create a tint box in the colour you want.