Data Manipulation
Peter Rote wrote:
I still struggling with this: error massage:
by(AlexETF,AlexETF$Industry,function(a) {filename = paste("C:/ab/",gsub("
","",a$Industry[1]),".txt",sep="")
+ print(filename) + write.table(a[,3,drop=FALSE],quote=FALSE,col.names=FALSE,row.names=FALSE) + } + ) [1] "C:/ab/Accident&HealthInsurance.txt" Error in `[.data.frame`(a, , 3, drop = FALSE) : undefined columns selected
The message says that you haven't got three columns in a, so try inserting print(dim(a)). Perhaps what you showed earlier was rownames plus two columns?
O__ ---- Peter Dalgaard ?ster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907