title: How do I run an r script from within an r script from within power BI?
body: <p>I have script like: </p>
  
  <pre><code>library('RPostgreSQL')
  
  source('credentials.R') # Defines USERNAME, PASSWORD, DBNAME, PORT, and HOST
  
  postgres &lt;- dbConnect(PostgreSQL(), 
      user=USERNAME, 
      password=PASSWORD, 
      dbname=DBNAME, 
      port=PORT, 
      host=HOST)
  
  results &lt;- dbGetQuery(postgres, "SELECT * FROM table;")
  </code></pre>
  
  <p>The script runs fine from RStudio, but when I run it as a data source in Power BI, <code>'credentials.R'</code> is not found.  How do I run this? </p>