-1

I have the following code:

unlink(dir, recursive = true)

And I am getting this error message:

* object 'true' not found

What is the cause of the error message?

Konrad Rudolph
  • 530,221
  • 131
  • 937
  • 1,214
Honza
  • 4,349
  • 2
  • 24
  • 40

1 Answers1

3

Boolean constants are in all caps - use TRUE/FALSE. Other languages usually define them as true/false. So the correct code would be:

unlink(dir, recursive = TRUE)
alko989
  • 7,688
  • 5
  • 39
  • 62
Honza
  • 4,349
  • 2
  • 24
  • 40
  • 2
    dot has a meaning, for example see: [`.`](https://stackoverflow.com/questions/35272457), see also [`...`](https://stackoverflow.com/questions/5890576/usage-of-three-dots-or-dot-dot-dot-in-functions) – zx8754 Nov 14 '18 at 09:27
  • @Honza While the first part of your reply is the correct answer, the second part is wrong, as previous poster pointed out. `.` can actually have many meanings and purposes. On a side note: you can abbreviate `TRUE` to `T` and `FALSE` to `F`. – Sacha Viquerat Nov 14 '18 at 09:52
  • @SachaViquerat If you abbreviate then take care: never write something like `T <- 0` or `F <- 1` in your code! – jogo Nov 14 '18 at 10:01
  • @jogo - so true! That's what `d`, `x` and `s` are for :) – Sacha Viquerat Nov 14 '18 at 10:04