title: Need to convert entire data frame of character strings to factor for association rules analysis
body: <p>I have a data frame of character strings and missing values that I need to convert to character factors in R in preparation for a market basket analysis. the rows are transactions without transaction IDs. I'm concerned that if I convert individual columns to factors, then the same item in two different columns will not be recognized as the same item after I then change the data frame to a transaction class. This is for a class. I met with the instructor who showed me this line in R 4.1:</p>
  <pre><code>newDF &lt;- factor(oldDF)
  </code></pre>
  <p>...but in R 4.2, this fails with the message:
  &quot;Warning in xtfrm.data.frame(x) : cannot xtfrm data frames&quot;</p>
  <p>The error makes sense to me as when I read up on the factor() function, it does alphabetize the result. For this reason, I'm guessing I don't want to convert the dataframe to a single, large vector and then run factor() on it.</p>
  <p>Maybe the trans() function from the &quot;a-rules&quot; package automagically deals with factors for the same item in different columns.</p>
  <p>I just want an item in one column to be evaluated as the same item in another column, but I don't know how assigning factors on an as-column basis supports this, with no guarantee that all items are represented in all of the columns.</p>