############################################## # # exp3_prep.R GRaab October 04 # # This file in d:/aprojects/peas/web/exemp2/pre-processing # # Assume that R is first started from this directory and # this file sourced into R # # data stored in d:/aprojects/peas/web/exemp2/data/ex2.Rdata # # system must download and install the foreign library # ############################################## library(foreign) health<-read.xport("../data/ex3.xpt") health$AGEG<- factor(floor(health$AGE/5)-2,labels=c( "16-19", "25-29","35-39","45-49","55-59","65-69", "70-74","60-64","50-54", "40-44","30-34", "20-24")) health$CIGST1<-factor(health$CIGST1,labels=c( "Refused/Not answered" , "Dont know", "schedule not obtained" , "not applicable" , "Never smoked cigarettes at all" , "Used to smoke cigarettes occasionally", "Used to smoke cigarettes regularly" , "Current cigarette smoker" )) health$CIGST2<-factor(health$CIGST2,labels=c( "Refused/Not answered" , "Don t know" , "not applicable" , "Light smokers, under 10 a day" , "Moderate smokers, 10 to under 20 a day" , "Heavy smokers, 20 or more a day" , "Non-smoker" )) health$REGION<-factor(health$REGION,labels=c( "Highlands & Islands" , "Grampian & Tayside" , "Lothian & Fife" , "Borders, Dumfries & Galloway" , "Glagow" , "Lanarkshire,Ayrshire & Arran" , "Forth Valley, Argyll & Clyde" )) health$HBOARD<-factor(health$HBOARD,labels=c( "Ayrshire & Arran" , "Borders" , "Argyll & Clyde" , "Fife" , "Greater Glasgow" , "Highland" , "Lanarkshire" , "Grampian" , "Orkney" , "Lothian" , "Tayside" , "Forth Valley" , "Western Isles" , "Dumfries & Galloway" , "Shetland" )) health$SEX<-factor(health$SEX,labels=c("male","female")) save.image("C:/Documents and Settings/gillian raab/My Documents/aprojects/peas/web/exemp3/data/ex3.RData") >