title: R Swirl Course and Google forms
body: <p>I have been unable to get the following code to work has anyone got any ideas why it is not delivering the content of swirl course undertaken by students into a Google Form via the URL.</p>
  <p>Sean Kross's Google_Forms_Course repository is where I have forked the original code and set it up exactly as described in the read.me. It seems to be an interaction problem with Google Forms and his original code was written a while ago. What part of this code might not interact with the new API maybe ... I really don't know to get to my own solution ... but I would really like to fix it.</p>
  <pre><code># Get the swirl state
      getState &lt;- function(){
        # Whenever swirl is running, its callback is at the top of its call stack.
        # Swirl's state, named e, is stored in the environment of the callback.
        environment(sys.function(1))$e
      }
      
  # Retrieve the log from swirl's state
      getLog &lt;- function(){
        getState()$log
      }
      
      submit_log &lt;- function(){
        
        # Please edit the link below
        pre_fill_link &lt;- &quot;Enter Google Form URL here&quot;
        
  # Do not edit the code below
        if(!grepl(&quot;=$&quot;, pre_fill_link)){
          pre_fill_link &lt;- paste0(pre_fill_link, &quot;=&quot;)
        }
        
        p &lt;- function(x, p, f, l = length(x)){if(l &lt; p){x &lt;- c(x, rep(f, p - l))};x}
        
        temp &lt;- tempfile()
        log_ &lt;- getLog()
        nrow_ &lt;- max(unlist(lapply(log_, length)))
        log_tbl &lt;- data.frame(user = rep(log_$user, nrow_),
                              course_name = rep(log_$course_name, nrow_),
                              lesson_name = rep(log_$lesson_name, nrow_),
                              question_number = p(log_$question_number, nrow_, NA),
                              correct = p(log_$correct, nrow_, NA),
                              attempt = p(log_$attempt, nrow_, NA),
                              skipped = p(log_$skipped, nrow_, NA),
                              datetime = p(log_$datetime, nrow_, NA),
                              stringsAsFactors = FALSE)
        write.csv(log_tbl, file = temp, row.names = FALSE)
        encoded_log &lt;- base64encode(temp)
        browseURL(paste0(pre_fill_link, encoded_log))
      }
  </code></pre>