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
matrix(to[match(dd,from)], nrow=nrow(dd))
match returns a vector without dimensions, so you need to recreate the matrix.
match