R: How do you apply grep() in lapply()
<p>I would like to apply grep() in R, but I am not really good in lapply(). I understand that lapply is able to take a list, apply function to each members and output a list. For instance, let <code>x</code> be a list consists of 2 members.</p>

<pre><code>&gt; x&lt;-strsplit(docs$Text," ")
&gt; 
&gt; x
[[1]]
 [1] "I"         "lovehttp"  "my"        "mum."      "I"         "love"     
 [7] "my"        "dad."      "I"         "love"      "my"        "brothers."

[[2]]
 [1] "I"         "live"      "in"        "Eastcoast" "now."      "Job.I"    
 [7] "used"      "to"        "live"      "in"        "WestCoast."  
</code></pre>

<p>I would like to apply grep() function to remove words consisting of http. So, I would apply:</p>

<pre><code>&gt; lapply(x,grep(pattern="http",invert=TRUE, value=TRUE))
</code></pre>

<p>But it does not work and it says</p>

<pre><code>Error in grep(pattern = "http", invert = TRUE, value = TRUE) : 
argument "x" is missing, with no default
</code></pre>

<p>So, I tried</p>

<pre><code>&gt; lapply(x,grep(pattern="http",invert=TRUE, value=TRUE,x))
</code></pre>

<p>But it says</p>

<pre><code>Error in match.fun(FUN) : 
'grep(pattern = "http", invert = TRUE, value = TRUE, x)' is not a 
function, character or symbol
</code></pre>

<p>A help please, and thanks!</p>