[Rd] warning or error upon type/storage mode coercion?

Benjamin Tyner btyner at gmail.com
Wed Sep 15 03:23:25 CEST 2010


Hi,

I'm aware that the language definition states "R objects are often 
coerced to different types during computations". Two questions:

1. Is it possible to configure the R environment so that, for example, 
coercion from (say) numeric to integer will throw a warning or an error? 
I realize that in the base R code alone, there are thousands of calls to 
as.integer() which would trigger such an event, so this would not be a 
very practical configuration...

2. So, assuming the answer to (1) is a resounding "no", does anyone care 
to state an opinion regarding the philosophical or historical rationale 
for why this is the case in R/S, whereas certain other interpreted 
languages offer the option to perform strict type checking? Basically, 
I'm trying to explain to someone from a perl background why the 
(apparent) lack of a "use strict; use warnings;" equivalent is not a 
hindrance to writing bullet-proof R code.

Thanks,
Ben



More information about the R-devel mailing list