title: How to change comma separated values in a single element to multiple columns and assign numeric coding
body: <p>I have many columns to transform into multiple columns in the data I have extracted from Google Drive file in R. The name of dataframe where the data is stored is <strong>Data</strong> </p>
  
  <p>Now, lets start with the following column in the extracted data in R with header and top 4 values:</p>
  
  <pre><code>Data$Param1
  -----------
  Private Bus, Private Car, Public Bus
  Private Car, Private Van, Public Bus
  Private Car
  Private Bus, Private Car
  </code></pre>
  
  <p>From above column we have four (4) set of values namely:</p>
  
  <ul>
  <li>Private Bus</li>
  <li>Private Car</li>
  <li>Private Van</li>
  <li>Public Bus</li>
  </ul>
  
  <p>How can I transform the column <strong>Data$Param1</strong> into respective columns for each element of the set of 4 values I have mentioned above and within each column the values should be "0" if absent in Data$Param1 and "1" if present in Data$Param1.</p>
  
  <p>Like this:</p>
  
  <pre><code>            Data$Param1              | Data$Param1_PrivateBus | Data$Param1_PrivateCar | Data$Param1_PrivateVan | Data$Param1_PublicBus |
  Private Bus, Private Car, Public Bus |          1             |            1           |            0           |           1           |
  Private Car, Private Van, Public Bus |          0             |            1           |            1           |           1           |
               Private Car             |          0             |            1           |            0           |           0           |
        Private Car, Private Bus       |          1             |            1           |            0           |           0           |
  </code></pre>
  
  <p>I have exactly 187 similar columns to transform having different set of values. Some column have set of 5 values while some has set of 6, 7, and 9 values.</p>
  
  <p>I am using R ver 3.4.1.</p>