0

I'm new, so it might be a silly question, but if you can answer this question, I would really appreciate it :)

If I have a bigger number (ANY NUMBER) and I am writing it into any R function (with a dot and without a dot) - it gives me two different results, what is the correct way to write it?

For example, the number is twenty seven thousand, but in R, do I write it with a dot - 27.000 or without a dot - 27000? (I am trying to calculate test statistic, for mean, and I want to subtract 27000 from the mean, and the result changes massively (depending on the dot) :D

Hope it makes sense, thank you for clarification and your help!

***I will delete the question immediately if it is inappropriate or against the policy?

Alison
  • 11
  • 1

1 Answers1

1

Question is OK! If you do calculations in R use numeric data without thousand dot. In a numeric variable a dot is usually referred to as decimal number sign: In your case I would do:

x <- 21976.95 - 27000

# Output:
> x
[1] -5023.05

But if you want to present a number, for example in a table then you can use both thousands and comma separator. See here: Format number in R with both comma thousands separator and specified decimals

TarJae
  • 72,363
  • 6
  • 19
  • 66