Challenge: recoding a data.frame() — make it faster

后端 未结 6 1635
借酒劲吻你
借酒劲吻你 2021-02-04 06:43

Recoding is a common practice for survey data, but the most obvious routes take more time than they should.

The fastest code that accomplishes the same task with the pr

6条回答
  •  -上瘾入骨i
    2021-02-04 06:46

    Try this:

    m <- as.matrix(dat)
    
    dat <- data.frame( matrix( re.codes[m], nrow = nrow(m)))
    

提交回复
热议问题