Displaying 1 result from an estimated 1 matches for "fin_dat".
Did you mean:
fin_day
2008 Apr 02
0
medians on data frame with duplicated rows
...ck a data frame.
>tclass <- c('A','B','C')
> tclass
[1] "A" "B" "C"
> for(i in 1:length(tclass)){
+ k = rtest[rtest$Class==tclass[i],]
+ if(nrow(k)>1){
+ x <- k[,c(-1,-2)]
+ rownames(x) <- k[,1]
+ k2 = apply(x,1,median)
+ fin_dat <- c(rtest$Name==max(names(k2)),)}
+ else{
+ fin_dat <- c(k)
+ }
+ }
Error in `row.names<-.data.frame`(`*tmp*`, value = c(4L, 4L, 2L)) :
duplicate 'row.names' are not allowed
my code:
for(i in 1:length(tclass)){
k = rtest[rtest$Class==tclass[i],] # selecting all students who...