monkeymike.co.uk

July 3, 2009

subset data

Filed under: R hints and Tips — @ 7:11 am

subset(dataframe, County==”CONWY”, c(N,date,hospital))

subsetting using an OR relation.

con2<-subset(ae,(AREA=="CONWY" & HEORG=="Ffestiniog_MIU" | AREA=="GWYNEDD" & HEORG=="Ffestiniog_MIU"), c(AT,AREA,DT_3,HEORG), order=c(HEORG,DT_3))

July 2, 2009

Importing data

Filed under: R hints and Tips — @ 5:45 pm

temp <- read.table('clipboard', header=TRUE)
DataFrameName <-read.csv ("C:/filename.csv", header= TRUE)

When importing from the clipboard make sure you don't have any commas or spaces in the data or the headings as it may fail to import correctly. You'll get errors talking about too many or to few columns if you leave them in.

Powered by WordPress