• Home
  • About R Trix
  • Teaching Resources
  • RTricks Library
  • Interactive Apps
  • Training Network
RTFR landingdist

Number Patterns

Different Ways of Counting with R

Try the following in R:
  • 1:5
  • 3:15
  • (1:5)*3
  • (3:15)*4
By clicking on the links, you should see the same result as you would get from R.
Now, figure out the R code for making the following patterns (also called sequences ):
  • 5, 10, 15, 20
  • 14, 21, 28, ..., 49
  • 12, 15, 18, ..., 300
  • 13, 16, 19, ..., 301

Powers

  • If you type 3^2, R calculates 3*3: 9.
  • If you type 3^4, R calculates 3*3*3*3: 81.
What happens when you try:
  • (1:5)^2
  • (1:5)^3
  • 2^(1:5)
  • 3^(1:5)