Skip to content
Prev 32271 / 63424 Next

How can I catch errors thrown from c via the Rcpperror() function?

Hi all, and thanks for the responses.

As per Bill's suggestion, I tried:

x <- try(flowClust(tFrame, K=30, B=1000, varNames=c('CD4', 'CD8','KI67', 
'CD45RO', 'CD28', 'CD57', 'CCR5', 'CD19','CD27', 'CCR7','CD127')), 
silent=TRUE)

and it caught the error.

Indeed,

 x <- try(res30 <- flowClust(tFrame, K=30, B=1000, varNames=c('CD4', 
'CD8','KI67', 'CD45RO', 'CD28', 'CD57', 'CCR5', 'CD19','CD27', 
'CCR7','CD127')), silent=TRUE)

caught the error. (What I really meant by "res30 = flowClust(...)" was 
"res30 <- flowClust(...)". I've fallen into the probably bad habit of 
using '=' in place of '<-' ) It had completely slipped my mind that '=' 
has a dual meaning, and that using it there might result in that part of 
my expression being evaluated as the passing of an argument.

Anyway, the point is that it works, and the error is caught when I use '<-'.

Thanks again for all your help (and an interesting peek into the nuts 
and bolts of R).

-Kieran
William Dunlap wrote: