I\'m trying to find a way of automating a large dataset to add two factors but the data may contain uneven rows.
I\'ve tried to do this with the \'rep\' function but thi
rep()'s length.out argument is one option:
rep()
length.out
df$state<-factor(rep(1:2, length.out = nrow(df)))