replace a list of values by another in R

前端 未结 3 918
别跟我提以往
别跟我提以往 2021-02-02 12:01

I have a dataframe with any of these values.

from=c(\"A\",\"C\",\"G\",\"T\",\"R\",\"Y\",\"M\",\"K\",\"W\", \"S\",\"N\")

and I want to replace a

3条回答
  •  北恋
    北恋 (楼主)
    2021-02-02 12:37

    matrix(to[match(dd,from)], nrow=nrow(dd))
    

    match returns a vector without dimensions, so you need to recreate the matrix.

提交回复
热议问题