[R] RODBC, sqlQuery with NA:s

Mark Wardle mark at wardle.org
Tue Apr 3 10:41:31 CEST 2007


Lauri Nikkinen wrote:
> Thanks Prof Ripley for your answer. In fact, there is no NULL's in these
> varchar variables, that is because one of the software's we use do not
> accept NULL's (that is strange, isn't it?). So, for instance, when I type
> 
> select * from table1
> where var1=''
> 
> I get all those rows where the cells of var1 are empty. So, is there any
> possibility to tell R that it should convert these empty cells to NA:s (when
> importing)?
> 

You could use a SQL case statement to do some pre-processing so that
RODBC can do the right thing.

Best wishes,

Mark

-- 
Dr. Mark Wardle
Specialist registrar, Neurology
Cardiff, UK



More information about the R-help mailing list