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.dalga...@biostat.ku.dk) FAX: (+45) 35327907 ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.