mutate function could not be found


The uploaded snapshot is the error I got trying to use mutate.
Please what can I do next?

I don't see anything wrong but it is hard to tell from a screenshot.

Please do not send screenshots. They are difficult to work with. Your screenshot is very clear but often they are difficult to read.

It is much better to copy the code and paste it here between

```

```

This gives us formatted code that we can copy, paste and run . Often a person here does not have the time to type out code to test it and find a problem and we can easily miss a minor space or typo in your code

This works for me

library(tidyverse)
mutate(diamonds, carat_2 = carat*100)

Looks like you just forgot to load the 'dplyr' package (or 'tidyverse' in general).

library(dplyr)

Then try again.

The screenshot shows library(tidyverse). So it's something weirder. And confirming @jrkrideau's post, the lines work for me too.

Can you show us all your code? I wonder if you may have an earlier code conflict.

I have loaded "dplyr" package below is the output:
Attaching package: ‘dplyr’

The following objects are masked from ‘package:stats’:

filter, lag

The following objects are masked from ‘package:base’:

intersect, setdiff, setequal, union

Then run library(tidyverse)
below is the output:
library(tidyverse)
Error: package or namespace load failed for ‘tidyverse’:
.onAttach failed in attachNamespace() for 'tidyverse', details:
call: NULL
error: package or namespace load failed for ‘readr’:
.onLoad failed in loadNamespace() for 'readr', details:
call: loadNamespace(x)
error: there is no package called ‘tzdb’

I have loaded "dplyr" package below is the output:
Attaching package: ‘dplyr’

The following objects are masked from ‘package:stats’:

filter, lag

The following objects are masked from ‘package:base’:

intersect, setdiff, setequal, union

Then run library(tidyverse)
below is the output:
library(tidyverse)
Error: package or namespace load failed for ‘tidyverse’:
.onAttach failed in attachNamespace() for 'tidyverse', details:
call: NULL
error: package or namespace load failed for ‘readr’:
.onLoad failed in loadNamespace() for 'readr', details:
call: loadNamespace(x)
error: there is no package called ‘tzdb’

Try shutting down R & RStudio, and restart , or even reboot .
This should work.

library(tidyverse)

# Run ---------------------------------------------------------------

mutate(diamonds, carat_2 = carat*100)

You do not need to load {dpyr} separately . It loads with {tidyverse}.

Another thing to check is if you are loading an .Rdata file from an earlier session.

Try Tools > Global Options and uncheck the Workspace options if they are selected and restart R & RStudio.

Thanks for your concern, as you have instructed, I did it but still, it did not work.

Well, let's see what this gives us. Do

sessionInfo()

and copy the result to the clipboard and paste here between
```

```

to give us something that is nicely formatted and easy to read.

There seems to be something very strange going on.

If you check the "packages" pane in RStudio, do you see tzdb listed?

Yes, I could see tzdb, when I read the error again and again then I installed the package "tzdb" and it eventually worked. Thanks so much.

I could see tzdb, when I read the error again and again then I installed the package "tzdb" and it eventually worked. Thanks so much.

I could see tzdb, when I read the error again and again then I installed the package "tzdb" and it eventually worked.

When I read the error again and again then I installed the package "tzdb" and it eventually worked. Thanks so much.

Nice one. I'd forgotten that package existed but I had it installed.

1 Like

This topic was automatically closed 90 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.