Replace values that starts with "<" in a data frame in r I am new to R and would like some assistance on replacing multiple values in a large dataset with many variables to NA at once in r.
I want all the cells with &quot;&lt;0.01, &lt;0.02, and many others with &lt; sign at the beginning&quot; to be changed to NA.

How do I do it at once? Here is a screenshot of the data.
Using gsub with a regular expression to replace every string starting with a &quot;&lt;&quot; with NA.
x &lt;- c(&quot;&lt;0.01&quot;, &quot;0.027&quot;, &quot;&lt;0.01&quot;, &quot;&lt;0.01&quot;, &quot;0.2&quot;, &quot;0.22&quot;, &quot;0.04&quot;, &quot;0.09&quot;)
gsub(&quot;&lt;.*&quot;, NA, x)
# [1] NA      &quot;0.027&quot; NA      NA      &quot;0.2&quot;   &quot;0.22&quot;  &quot;0.04&quot;  &quot;0.09&quot;