Code without visible output:


In [1]:
a <- 8

In [2]:
b <- 4:59

With visible output:


In [3]:
a + b


Out[3]:
  1. 12
  2. 13
  3. 14
  4. 15
  5. 16
  6. 17
  7. 18
  8. 19
  9. 20
  10. 21
  11. 22
  12. 23
  13. 24
  14. 25
  15. 26
  16. 27
  17. 28
  18. 29
  19. 30
  20. 31
  21. 32
  22. 33
  23. 34
  24. 35
  25. 36
  26. 37
  27. 38
  28. 39
  29. 40
  30. 41
  31. 42
  32. 43
  33. 44
  34. 45
  35. 46
  36. 47
  37. 48
  38. 49
  39. 50
  40. 51
  41. 52
  42. 53
  43. 54
  44. 55
  45. 56
  46. 57
  47. 58
  48. 59
  49. 60
  50. 61
  51. 62
  52. 63
  53. 64
  54. 65
  55. 66
  56. 67

Printing is captured and sent to the frontend:


In [4]:
print('Hello world! Love, R in Jupyter.')


[1] "Hello world! Love, R in Jupyter."

So are errors:


In [5]:
f2 <- function() stop('deep error')
throw <- function() f2()

In [6]:
'this line is run / displayed'
throw()
'this line is not run / displayed'


Out[6]:
'this line is run / displayed'
Error in f2(): deep error
Traceback:

1. throw()
2. f2()   # at line 2 of file <text>
3. stop("deep error")   # at line 1 of file <text>

Plotting works too:


In [7]:
x <- seq(0, 2*pi, length.out=50)
plot(x, sin(x))