Hallie Sheikh
Hallie Sheikh

Reputation: 431

How to code exponential numbers with powers in R?

I want to multiply a this number 4.193215e+12 with a dataframe. My code is

df <- cbind(Dataset = df$Dataset, df[,2:4] * 4.193215e^12

However an error appears. What is the proper way to code this number 4.193215e+12 in R?

Upvotes: 0

Views: 119

Answers (1)

Carl Witthoft
Carl Witthoft

Reputation: 21502

While this is found in the not-quite-obvious location ?NumericConstants , I am hard-pressed to think of a language in which Xe^Y is syntactically correct. Always use either e or ^ for powers.

Upvotes: 1

Related Questions