title: R code on Google docs
body: <p>I'm aware that you can publish spreadsheets on Google docs and then import them in R. However,  let's say I have a function or some code I want to read in R (like in the source function). How would you for example read in all this code stored on google docs?</p>
  
  <p><a href="https://docs.google.com/document/edit?id=1f11rcVs9AtVcgOyiP0lV04yq9hshVDIPx93lA0ItFvQ">https://docs.google.com/document/edit?id=1f11rcVs9AtVcgOyiP0lV04yq9hshVDIPx93lA0ItFvQ</a></p>
  
  <p>I don't think this has been published but it's just to give an example.</p>
  
  <p>Basically I want to:</p>
  
  <ol>
  <li><p>Create a function in R (for comparability see example below)</p></li>
  <li><p>Upload it on Google Docs and share it with anyone with the link so that I don't have to log in through R or Google Docs etc...</p></li>
  <li><p>Read it in through a command like source() wherever I want</p></li>
  </ol>
  
  <p>My interest is not in reading data but in reading functions. It would make importing my own functions much quicker when I'm not on the same computer/server.</p>
  
  <p>Any ideas?</p>
  
  <p>Many thanks</p>
  
  <p>P.S. Example of a function from statsmethods.net</p>
  
  <pre><code>mysummary &lt;- function(x,npar=TRUE,print=TRUE) {
    if (!npar) {
      center &lt;- mean(x); spread &lt;- sd(x) 
    } else {
      center &lt;- median(x); spread &lt;- mad(x) 
    }
    if (print &amp; !npar) {
      cat("Mean=", center, "\n", "SD=", spread, "\n")
    } else if (print &amp; npar) {
      cat("Median=", center, "\n", "MAD=", spread, "\n")
    }
    result &lt;- list(center=center,spread=spread)
    return(result)
  }
  </code></pre>