index.html 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. <!doctype html>
  2. <title>CodeMirror: R mode</title>
  3. <meta charset="utf-8"/>
  4. <link rel=stylesheet href="../../doc/docs.css">
  5. <link rel="stylesheet" href="../../lib/codemirror.css">
  6. <script src="../../lib/codemirror.js"></script>
  7. <script src="r.js"></script>
  8. <style>
  9. .CodeMirror { border-top: 1px solid silver; border-bottom: 1px solid silver; }
  10. .cm-s-default span.cm-semi { color: blue; font-weight: bold; }
  11. .cm-s-default span.cm-dollar { color: orange; font-weight: bold; }
  12. .cm-s-default span.cm-arrow { color: brown; }
  13. .cm-s-default span.cm-arg-is { color: brown; }
  14. </style>
  15. <div id=nav>
  16. <a href="http://codemirror.net"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png"></a>
  17. <ul>
  18. <li><a href="../../index.html">Home</a>
  19. <li><a href="../../doc/manual.html">Manual</a>
  20. <li><a href="https://github.com/codemirror/codemirror">Code</a>
  21. </ul>
  22. <ul>
  23. <li><a href="../index.html">Language modes</a>
  24. <li><a class=active href="#">R</a>
  25. </ul>
  26. </div>
  27. <article>
  28. <h2>R mode</h2>
  29. <form><textarea id="code" name="code">
  30. # Code from http://www.mayin.org/ajayshah/KB/R/
  31. # FIRST LEARN ABOUT LISTS --
  32. X = list(height=5.4, weight=54)
  33. print("Use default printing --")
  34. print(X)
  35. print("Accessing individual elements --")
  36. cat("Your height is ", X$height, " and your weight is ", X$weight, "\n")
  37. # FUNCTIONS --
  38. square <- function(x) {
  39. return(x*x)
  40. }
  41. cat("The square of 3 is ", square(3), "\n")
  42. # default value of the arg is set to 5.
  43. cube <- function(x=5) {
  44. return(x*x*x);
  45. }
  46. cat("Calling cube with 2 : ", cube(2), "\n") # will give 2^3
  47. cat("Calling cube : ", cube(), "\n") # will default to 5^3.
  48. # LEARN ABOUT FUNCTIONS THAT RETURN MULTIPLE OBJECTS --
  49. powers <- function(x) {
  50. parcel = list(x2=x*x, x3=x*x*x, x4=x*x*x*x);
  51. return(parcel);
  52. }
  53. X = powers(3);
  54. print("Showing powers of 3 --"); print(X);
  55. # WRITING THIS COMPACTLY (4 lines instead of 7)
  56. powerful <- function(x) {
  57. return(list(x2=x*x, x3=x*x*x, x4=x*x*x*x));
  58. }
  59. print("Showing powers of 3 --"); print(powerful(3));
  60. # In R, the last expression in a function is, by default, what is
  61. # returned. So you could equally just say:
  62. powerful <- function(x) {list(x2=x*x, x3=x*x*x, x4=x*x*x*x)}
  63. </textarea></form>
  64. <script>
  65. var editor = CodeMirror.fromTextArea(document.getElementById("code"), {});
  66. </script>
  67. <p><strong>MIME types defined:</strong> <code>text/x-rsrc</code>.</p>
  68. <p>Development of the CodeMirror R mode was kindly sponsored
  69. by <a href="https://twitter.com/ubalo">Ubalo</a>.</p>
  70. </article>
PANIC: session(release): write data/sessions/d/f/df14ccf8b02352e6: no space left on device

PANIC

session(release): write data/sessions/d/f/df14ccf8b02352e6: no space left on device
github.com/go-macaron/session@v0.0.0-20190805070824-1a3cdc6f5659/session.go:199 (0x8b2934)
gopkg.in/macaron.v1@v1.3.9/context.go:79 (0x83d0a0)
github.com/go-macaron/inject@v0.0.0-20160627170012-d8a0b8677191/inject.go:157 (0x80ab07)
github.com/go-macaron/inject@v0.0.0-20160627170012-d8a0b8677191/inject.go:135 (0x80a8a8)
gopkg.in/macaron.v1@v1.3.9/context.go:121 (0x83d1f8)
gopkg.in/macaron.v1@v1.3.9/context.go:112 (0x84fdb5)
gopkg.in/macaron.v1@v1.3.9/recovery.go:161 (0x84fda8)
gopkg.in/macaron.v1@v1.3.9/logger.go:40 (0x840c73)
github.com/go-macaron/inject@v0.0.0-20160627170012-d8a0b8677191/inject.go:157 (0x80ab07)
github.com/go-macaron/inject@v0.0.0-20160627170012-d8a0b8677191/inject.go:135 (0x80a8a8)
gopkg.in/macaron.v1@v1.3.9/context.go:121 (0x83d1f8)
gopkg.in/macaron.v1@v1.3.9/router.go:187 (0x850fc6)
gopkg.in/macaron.v1@v1.3.9/router.go:303 (0x8493e5)
gopkg.in/macaron.v1@v1.3.9/macaron.go:220 (0x841fca)
net/http/server.go:2836 (0x7a79b2)
net/http/server.go:1924 (0x7a341b)
runtime/asm_amd64.s:1373 (0x46f9f0)