Convert columns with certain column names from factor to character
<p>I have a large dataset with few 100 columns. Some of the columns are of type factor. I want to convert these columns from <code>factor</code> to <code>character</code>. I know in can convert them individually using the function <code>as.character</code> like this below</p>

<pre><code>     df$col_test_1 = as.character(df$col_test_1)
</code></pre>

<p>However I am looking for an efficient way to convert all columns that have a certain common string in their column name for example <code>_test_</code> . Convert all columns where their column name contains the string <code>_test_</code> from <code>factor</code> to <code>character</code>. Any suggestions or tips on how to do this is much appreciated. Thanks.</p>