Question: I need to save a CGDDisplayModeRef to a plist file but none of the available types are good for storing CGDisplayModeRef. Is there a way around this?

Answer: 
I would have used:

```
testdf$groupCode <- cut(testdf$b, breaks = 
                           quantile(testdf$b, seq(0,1, by=0.05), na.rm=TRUE))
grpbrks <- quantile(testdf$b, seq(0,1, by=0.05), na.rm=TRUE)

```

Then you can use:

```
 findInterval(newdat$newvar, grpbrks)   # to group new data

```

And you then won't need to screw around with recovering the breaks from the labels or the data.

Thinking about, I guess you could also use:

```
 cut(newdat$newvar, grpbrks)  # more isomorphic to original categorization I suppose

```
Screwing around with some regular expressions seems to be the only way of actually returning the value of an object resulting from `cut`.

The following code does the necessary screwing:

```
cut_breaks <- function(x){
  first <- as.numeric(gsub(".{1}(.+),.*", "\\1", levels(x))[1])
  other <- as.numeric(gsub(".+,(.*).{1}", "\\1", levels(x)))
  c(first, other)
}

set.seed(1)
x <- rnorm(100)

cut1 <- cut(x, breaks=20)
cut_breaks(cut1)
 [1] -2.2200 -1.9900 -1.7600 -1.5300 -1.2900 -1.0600 -0.8320 -0.6000 -0.3690
[10] -0.1380  0.0935  0.3250  0.5560  0.7870  1.0200  1.2500  1.4800  1.7100
[19]  1.9400  2.1700  2.4100

levels(cut1)
 [1] "(-2.22,-1.99]"   "(-1.99,-1.76]"   "(-1.76,-1.53]"   "(-1.53,-1.29]"  
 [5] "(-1.29,-1.06]"   "(-1.06,-0.832]"  "(-0.832,-0.6]"   "(-0.6,-0.369]"  
 [9] "(-0.369,-0.138]" "(-0.138,0.0935]" "(0.0935,0.325]"  "(0.325,0.556]"  
[13] "(0.556,0.787]"   "(0.787,1.02]"    "(1.02,1.25]"     "(1.25,1.48]"    
[17] "(1.48,1.71]"     "(1.71,1.94]"     "(1.94,2.17]"     "(2.17,2.41]"    

```

You can then pass these break values to `cut` using the `breaks=` parameter to make your second cut.