how to replace the value of a column with factor level based on defined factors in R
<p>I have a <a href="https://drive.google.com/open?id=0Bwtr4KKIbBfkQ0tkQS1vaElSNkU" rel="nofollow noreferrer">dataset</a>, where I defined the factors for rows <code>gene.fac</code> and columns <code>cell.fac</code>.</p>

<pre><code>load('Analysis.RData')
top200_groups &lt;- data.frame (cluster = cell.fac,  t(top200))
melted &lt;- melt(top200_groups, id.vars=c("cluster"))
</code></pre>

<p>After the application with <code>melt</code> function, I can see</p>

<p><a href="https://i.stack.imgur.com/B5EnW.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/B5EnW.jpg" alt="enter image description here"></a></p>

<p>Then I want to replace the genename in <code>melted$variable</code> with the factors defined in <code>gene.fac</code>.</p>

<p>Is there easy way to transform this? Thanks.</p>