Hello,
I 'm a beginner in R. I try typing the following :
g <- 5i +5
print(g)
the result is : [1] 5+ 5i
However, when typing :
g <- 5h + 5
Error: unexpected symbol in "g <- 5h +5"
I don't know the reason it causes that error.
Thank you,
Viny
FJCC
May 27, 2021, 5:01pm
2
By using i in the first example, you are making a complex number.
g <- 5i + 5
g
[1] 5+5i
class(g)
[1] "complex"
The letter h does not have that special meaning and so causes an error. What are you trying to do with 5h + 5
?
windynite:
5i +5
Do you mean 5h is "5 times h" with h is a numeric constant value/vector? If so then use *
as g <- 5*h+5
Thank you for your reply. Those are examples that I made to understand the reason.
system
Closed
June 17, 2021, 7:18pm
5
This topic was automatically closed 21 days after the last reply. New replies are no longer allowed. If you have a query related to it or one of the replies, start a new topic and refer back with a link.