title: R+Tableau connection: Using linear regression & Relaimpo package; Working in R but not in connection
body: <p>I am applying a linear regression model to data, and using the relaimpo package to find the most significant factors.</p>
  
  <p>When running the following code in R, it works fine</p>
  
  <pre><code>library(readxl)
  nba &lt;- read_excel("XXXX")
  View(nba)
  
  
  library(relaimpo)
  rec = lm(won ~ o_fgm + o_ftm + o_pts , data = nba)
  x= calc.relimp(rec, type = c("lmg"), rela = TRUE, rank = TRUE)
  x$lmg
  </code></pre>
  
  <p>I get output of:</p>
  
  <pre><code>    o_fgm     o_ftm     o_pts 
  0.3374366 0.2628543 0.3997091 
  </code></pre>
  
  <p>When connecting via Tableau I use the following code:</p>
  
  <pre><code>SCRIPT_REAL("
  won=.arg1
  o_fgm=.arg2
  o_ftm=.arg3
  o_pts=.arg4
  
  
  library(relaimpo)
  rec = lm(won ~ o_fgm + o_ftm + o_pts)
  x= calc.relimp(rec, type = c('lmg'), rela = TRUE, rank = TRUE)
  
  "
  ,MEDIAN([Won]),MEDIAN([O Fgm]),MEDIAN([O Ftm]),MEDIAN([O Pts]))
  </code></pre>
  
  <p>I am getting the following error:</p>
  
  <pre><code>An error occurred while communicating with the RServe service.
  Error in calc.relimp.default.intern(object = structure(list(won = 39, : Too few complete observations for estimating this model
  </code></pre>
  
  <p>I have run it with just the regression and it runs fine; so it seems the issue is with the relaimpo package. There is limited documentation online on this package so I cannot find a fix; any help is really appreciated thanks!</p>
  
  <p>Data is from kaggle at <a href="https://www.kaggle.com/open-source-sports/mens-professional-basketball" rel="nofollow noreferrer">https://www.kaggle.com/open-source-sports/mens-professional-basketball</a></p>
  
  <p>(the "basketball_teams.csv" file)</p>