You never defined a variable R (its just a local(!) variable inside of your program). So Prime does not know if you mean the predefined unit R or the predefined constant R - hence the error message.

You defined a function which would have to be called to be evaluated. But as I think you just intended to create a vector R, you should assign the program to that variable.
Furthermore you were missing some multiplications and a pair of parenthesis (otherwise you run into a unit mismatch in the calculation of C).
Its not necessary to redefine e and also omega.n was already defined above.

The start and end value of your for-loop are wrong and off by 1.
But you now run into a unit mismatch in the definition of U. You can't add quantities with different dimensions!
You will have to check your formulas!
