invalid factor level, NA generated when I try to add row to dataframe with var1 and Freq

703 views Asked by At

I have a data frame, the head of which is:

head(loss_freq_table)
   Var1 Freq
1 1101   19
2 1102   18
3 1103   12
4 1104   19
5 1105   16
6 1106   12

However, when I type loss_by_team<-rbind(loss_by_team, data.frame(Var1=1455, Freq=0)), I get the error

Warning message:
 In `[<-.factor`(`*tmp*`, ri, value = 1455) :
   invalid factor level, NA generated

and when I type loss_by_team[which(loss_by_team$Var1=="1455"), ], I get

[1] Var1 Freq
<0 rows> (or 0-length row.names)

anyone know why this is?

0

There are 0 answers