I obtained error messages when I run these commands in UNIX, but I
obtained correct result when I run these command in WINDOWS. Can
somebody point out the problem and give the solution. Thanks.
> dt<-read.table(file="Fall.dat")
> dim(dt)
[1] 1941 5
> table(dt$V2)
0 1 2 3
220 989 639 93
>
> Favg<-as.matrix(c(1:max(dt$V2)))
>
> for(i in 1:max(dt$V2)){Favg[i]<-mean(dt[which(dt[,2] == i),5])}
> Favg
[,1]
[1,] NA
[2,] NA
[3,] NA
Warning messages:
argument is not numeric or logical: returning NA (etc)
______________________________________________
[email protected] 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.