title: R Workspace and creating a factor variable from a numeric variable
body: <p>I am a new beginner learning R. My question should be related to either R's Workspace or creating a factor variable or both. Here is my problem: I used this syntax to open a csv file titled "lecturerData":</p>
  
  <pre><code>lecturerData &lt;- read.csv("Lecturer Data.csv" , header = TRUE)
  </code></pre>
  
  <p>This file has a column titled "job" which has two neumwric values: 1 and 2. I want to change these values to a factor variable so that 1 represents Lecturer and 2 represent Student. So, I used this syntax:</p>
  
  <p><code>job &lt;- factor (job, levels = c(1:2), labels=c("Lecturer","Student"))</code></p>
  
  <p>But I receive this error message: </p>
  
  <pre><code>object 'job' not found
  </code></pre>
  
  <p>Then I changed the above syntax to:</p>
  
  <pre><code>lecturerData$job &lt;- factor (lecturerData$job, levels = c(1:2),
                              labels=c("Lecturer","Student"))
  </code></pre>
  
  <p>And it works. I feel that I am missing something here.</p>
  
  <p>Would appreciate your help.</p>