Hi There,

I get the following error from the code pasted below: Error in storage.mode(test) <- "logical" :
  object 'HGBmt12_Natl_Ave_or_Facility' not found

library(RODBC)
library(car)
setwd("c://temp//cms")
a07.connect <- odbcConnectAccess2007("DFC.accdb")
sqlTables(a07.connect) ##provides list of tables##
dataset <- sqlFetch(a07.connect,'Analysis File 2007-2009') #puts dfc data into table mydata
str(dataset)

#this works and gives correct values
HGlt102009=dataset[,6]
HGBL10_F_2007 =dataset[,11]
HGmt122009=dataset[,7]
HGBL12_F_2007 = dataset[,16]
URRmt65Perc2009 = dataset[,3]
URRG65_F_2007=dataset[,22]
yes1=HGlt102009-HGBL10_F_2007
no1=HGlt102009-2
yes2=HGmt122009-HGBL12_F_2007
no2=HGmt122009-26
yes3=URRG65_F_2007-URRmt65Perc2009
no3=96-URRmt65Perc2009
Analysis2009 <- transform(dataset
 , HGBlt10_Natl_Ave_or_Facility = recode(HGBL10_F_2007,"0:2='National'; else='Facility'")
 , HGBmt12_Natl_Ave_or_Facility = recode(HGBL12_F_2007,"0:26='National'; else='Facility'")
 , URRmt65_Natl_Ave_or_Facility = recode(URRG65_F_2007,"96:100='National'; else='Facility'")
 , HGlt10RawPerc = ifelse(HGBlt10_Natl_Ave_or_Facility == "Facility",yes1,no1)
 , HGmt12RawPerc = ifelse(HGBmt12_Natl_Ave_or_Facility == "Facility",yes2,no2)
 , URRmt65Perc = ifelse(URRmt65_Natl_Ave_or_Facility == "Facility",yes3,no3)
 ,  HGBlt10Points<-recode(HGlt10RawPerc ,"-1001:0=10; 0:1=8; 1:2=6; 2:3=4; 3:4=2; else=0 ")
 ,  HGBlt12Points<-recode(HGlt12RawPerc ,"-1001:2=6; 2:3=4; 3:4=2; else=0 ")
 ,  URRmt65Points<-recode(HGlt10RawPerc ,"-1001:0=10; 0:1=8; 1:2=6; 2:3=4; 3:4=2; else=0 ")
)

Any ideas on what it means and why?  I'd really appreciate it!!  Thank you!!

Sincerely,

tom



	[[alternative HTML version deleted]]

