S | R Documentation |
'S' and 'Basic' converts a R object to a Basic object. 'Symbol', 'Real' and 'Constant' construct a Basic object with type "Symbol", "RealDouble"/"RealMPFR" and "Constant", respectively.
S(x) Basic(x) Symbol(x) Constant(x) Real(x, prec = NULL)
x |
A R object. |
prec |
If supplied, the argument will be parsed as a Basic object of type RealMPFR. |
For double vector, 'S' will check whether it is a whole number – if true, it will be converted to a Integer type. If this behavior is not desired, you can use 'Basic' or 'as(x, "Basic")'.
A Basic
S4 object.
S("(x + y)^2") S(~ (x + y)^2) S(NaN) S(42) Basic(42) as(42, "Basic") pi <- Constant("pi") evalf(pi) if (symengine_have_component("mpfr")) evalf(pi, 300) Real(42) if (symengine_have_component("mpfr")) Real(42, prec = 140)