Exponentiation of a vector

36 views Asked by At

Why is this true:

1:5 ^ 2
#>  [1]  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25

In my mind, it should be this:

1:5 ^ 2
#> [1]    1    4   27  256 3125

I tired looking up youtube videos to get an explanation or just googling exponentiation in R but I can't find it. I think it might have something to do with order of operations but it's been a long time since I've covered that topic.

0

There are 0 answers