[R] Data Manipulation

Jim Lemon jim at bitwrit.com.au
Tue Jan 26 11:46:50 CET 2010


On 01/26/2010 09:15 PM, 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

Hi Peter,
I would suggest that you print the first say 10 rows of "a" and see if 
it has three columns.

Jim



More information about the R-help mailing list