Error in running randomForest : object not found
<p>So i am trying to fit a random forest classifier for my dataset. I am very new to R and i imagine this is a simple formatting issue.</p>

<p>I read in a text file and transform my dataset so it is of this format: (taking out confidential info)</p>

<pre><code>&gt;head(df.train,2)

   GOLGA8A     ITPR3   GPR174  SNORA63    GIMAP8     LEF1    PDE4B LOC100507043    TGFB1I1    SPINT1
Sample1  3.726046 3.4013711 3.794364 4.265287 -1.514573 7.725775 2.162616    -1.514573 -1.5145732 -1.514573
Sample2 4.262779 0.9261892 4.744096 7.276971 -1.514573 4.694769 4.707387     2.031476 -0.8325444  2.615991
...
...
CD8B     FECH    PYCR1 MGC12916     KCNA3 resp
Sample1  -1.514573 2.099336 3.427928 1.542951 -1.514573    1
Sample2 -1.145806 1.204241 2.846832 1.523808  1.616791    1
</code></pre>

<p>In essence the columns are my features and the rows my samples, the last column is my response vector which is a column of factors, resp.</p>

<p>Then i use:</p>

<pre><code>set.seed(1) #Set the seed in order to gain reproducibility

RF1 = randomForest(resp~., data=df.train,ntree=1000,importance=T,mtry=3)
</code></pre>

<p>Simply trying to train the RF on my column <code>resp</code> using the other columns as features.</p>

<p>But I obtain the error:</p>

<pre><code>Error in eval(expr, envir, enclos) : object 'PCNA-AS1' not found
</code></pre>

<p>However, looking into my training set I can clearly find that column, e.g with:  </p>

<pre><code>sort(unique(colnames(df.train))
</code></pre>

<p>So I don't really understand the error or where to go from here. My apologies if I haven't posed the question in the correct way, thanks for any and all help!</p>