title: R Missing Values
body: <p>I am new to R and trying to run a factor analysis (method = pca. rotation = varimax and number of factors is 6). I've a survey data that I loaded to R, and then selected a subset of cases, and variables. I did the following:</p>
  
  <pre><code>arab&lt;-read.table("C:\\Users\\admin\\Desktop\\spsapaper\\arabb.csv",header=T,sep=",")
  
  abjor&lt;-subset(arab,COUNTRY=="1")
  
  items&lt;- c("Q2011", "Q2012", "Q4012", "Q4013", "Q5022", "Q5051", "Q5052", "Q5056", "Q5055", "Q6131", "Q6133", "Q6132", "Q2464", "Q2462", "Q2013", "Q2473", "Q2476", "Q2475", "Q2014", "Q5022", "Q2323")
  
  
  install.packages("psych")
  
  library(psych)
  </code></pre>
  
  <p>So far everything ran smoothly, and I used the fix() function to check the data in the editor and it worked. Then I ran:</p>
  
  <pre><code>fit &lt;- factanal(abjor, 6, rotation="varimax")
  </code></pre>
  
  <p>and it gave me:</p>
  
  <pre><code> Error in cov.wt(z) : 'x' must contain finite values only
  </code></pre>
  
  <p>I tried to fix the problem by deleting missing values via:</p>
  
  <pre><code>abjorr&lt;- na.omit(abjor)
  </code></pre>
  
  <p>and it gave me</p>
  
  <pre><code>Error in factanal(abjorr, 6, rotation = "varimax") : 
    factor analysis applies only to numerical variables
  </code></pre>
  
  <p>The <code>fix()</code> produced an empty data editor with no values.</p>
  
  <p>Then, I tried, <code>nabjor&lt;- v[ !is.na( abjor ) ]</code></p>
  
  <p>and ran <code>fix()</code> and it produced a data editor with all <code>NA</code> values. </p>
  
  <p>I'm trying to handle missing values to run a factor analysis, but it seems that I'm missing something?</p>