decode(c(2,2,2,2), c(1,0,1,1)) # Find the base 10 value of the base 2 number 1011.
decode(2, c(1,0,1,1)) # left argument is extended to vector c(2,2,2,2)
decode(c(365,24,60), c(2,1,57)) # transform 2 days 1 h 57 min in minutes
decode(c(365,24,60), c(1,57)) # right vector extended
decode(c(24,60), c(2,1,57)) # left vector extended
decode(1.5, c(1,2,3)) # polynomial 1*x^2 +2*x +3 evaluated at x=1.5
Run the code above in your browser using DataLab