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 Best, Peter -- View this message in context: http://n4.nabble.com/Data-Manipulation-tp1018249p1290191.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ 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.