 <p>It looks like they're already names of variables in your workspace?</p> <pre><code>x &lt;- ls()[grep('^x\\d', ls())] </code></pre> <p>That might get you there if you don't have anything else that starts with an x and a number that you want to include.</p> <p>If they're text strings that you're pasting in or something then perhaps</p> <pre><code>x &lt;- scan() </code></pre> <p>(In general, your question was quite vague)</p>