<commit_before><div class="wrap">

  <div class="basicHero">
    <h1>Connect to AACT using R & RStudio</h1>

  </div>

</div>

<section class="rAccess">
  <div class="wrap">

    <div class="step">
      <span class="stepNumber">1</span>
      <h3 class="stepName">Download and install R and RStudio</h3>
    </div>

    <p>If R and RStudio are not already installed, install from these two links:</p>

    <p><a href="https://cran.r-project.org/">Install R from your closest mirror</a></p>
    <p><a href="https://www.rstudio.com/products/rstudio/">Install RStudio</a></p>


    <div class="step">
      <span class="stepNumber">2</span>
      <h3 class="stepName">Connect RStudio to AACT from the command line</h3>
    </div>

    <p>Once R and RStudio are installed, run the following commands using the latest AACT 2.0 connection information</p>
    <pre>
      <code>> install.packages("RPostgreSQL")</code>
      <code class="output">trying URL 'https://cran.rstudio.com/bin/macosx/mavericks/contrib/3.3/RPostgreSQL_0.4-1.tgz'</code>
      <code class="output">Content type 'application/x-gzip' length 306320 bytes (299 KB)</code>
      <code class="output">==================================================</code>
      <code class="output">downloaded 299 KB</code>
      <code>> library(RPostgreSQL)</code>
      <code class="output">Loading required package: DBI</code>
      <code>> drv <- dbDriver('PostgreSQL')</code>
      <code>> con <- dbConnect(drv, dbname="<%= ENV["RDS_DB_READONLY_DBNAME"] %>",host="<%= ENV["RDS_DB_HOSTNAME"] %>",port=5432,user="<%= ENV["RDS_DB_READONLY_USERNAME"] %>",password="<%= ENV["RDS_DB_READONLY_PASSWORD"] %>")</code>
      <code>> aact_sample <- dbGetQuery(con,"select distinct study_type from studies")</code>
      <code>> write.csv(aact_sample, file='aact_sample.csv')</code>
    </pre>

    <h2>Credentials</h2>
    <p>You will need the following information to access the database directly in the cloud.</p>
    <%= render 'access/credentials' %>


  </div>

</section><commit_msg>Refine the way the Code box info is displayed on the R/RStudio connection page.<commit_after><div class="wrap">

  <div class="basicHero">
    <h1>Connect to AACT using R & RStudio</h1>
  </div>

</div>

<section class="rAccess">
  <div class="wrap">

    <div class="step">
      <span class="stepNumber">1</span>
      <h3 class="stepName">Download and install R and RStudio</h3>
    </div>

    <p>If R and RStudio are not already installed, install from these two links:</p>

    <p><a href="https://cran.r-project.org/">Install R from your closest mirror</a></p>
    <p><a href="https://www.rstudio.com/products/rstudio/">Install RStudio</a></p>


    <div class="step">
      <span class="stepNumber">2</span>
      <h3 class="stepName">Connect RStudio to AACT from the command line</h3>
    </div>

    <p>Once R and RStudio are installed, run the following commands using AACT credentials.</p>
    <p class='CodeRay'>
    <pre>
      <p class='code'>
        <span class='command-prompt'>></span><span class='command-entry'> install.packages("RPostgreSQL")</span>
        <span class='command-response'>trying URL 'https://cran.rstudio.com/bin/macosx/mavericks/contrib/3.3/RPostgreSQL_0.4-1.tgz'</span>
        <span class='command-response'>Content type 'application/x-gzip' length 306320 bytes (299 KB)</span>
        <span class='command-response'>==================================================</span>
        <span class='command-response'>downloaded 299 KB</span>
        <span class='command-prompt'>> </span><span class='command-entry'>library(RPostgreSQL)</span>
        <span class='command-response'>Loading required package: DBI</span>
        <span class='command-prompt'>> </span><span class='command-entry'>drv &lt;- dbDriver('PostgreSQL')</span>
        <span class='command-prompt'>> </span><span class='command-entry'>con &lt;- dbConnect(drv, dbname="<%= ENV['RDS_DB_READONLY_DBNAME'] %>",host="<%= ENV['RDS_DB_HOSTNAME'] %>", port=5432, user="<%= ENV['RDS_DB_READONLY_USERNAME'] %>", password="<%= ENV['<PASSWORD>'] %>")</span>
        <span class='command-prompt'>> </span><span class='command-entry'>aact_sample <- dbGetQuery(con, "select distinct study_type from studies")</span>
        <span class='command-prompt'>> </span><span class='command-entry'>write.csv(aact_sample, file='aact_sample.csv')</span>
      </p>
    </pre>

  </div>
</section>
{'fraction_non_alphanumeric': 0.20176630434782608, 'fraction_numerical': 0.014039855072463768, 'mean_word_length': 4.184272300469484, 'pattern_counts': {'":': 0, '<': 152, '<?xml version=': 0, '>': 160, 'https://': 6, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6511614', 'n_tokens_mistral': 1531, 'n_tokens_neox': 1442, 'n_words': 324}