sparkr dataframe filter by column using regex
<p>I have a <code>sparkR</code> dataframe called Tweets with a column named <code>bodyText</code>.</p>

<p>What I am trying to do is filter the dataframe by a regex condition on the bodyText. So for example filter by tweets that have "rally" or "protest" in the bodyText.</p>

<p>What I have tried so far is:</p>

<pre><code>subset(twitter_df, grepl("(?&lt;=\\b)rally", twitter_df$bodyText, ignore.case = TRUE))
filter(twitter_df, grepl("(?&lt;=\\b)rally", twitter_df$bodyText, ignore.case = TRUE))
</code></pre>

<p>but in both cases receive this error:</p>

<blockquote>
  <p>Error in as.character.default(x) :
    no method for coercing this S4 class to a vector
  Calls: main ... .local -> [ -> grepl -> as.character -> as.character.default</p>
</blockquote>