juse juse - 1 month ago 5x
R Question

RMarkdown error with melt() function

I'm trying to create a file word starting from a program that on console perfectly works.

The problem is that when it reaches a function that uses

it generates an error

cannot find melt function

and stops compiling the code.

The package
is installed, and I tried to rerun the code without using markdown and it doesn't generate any error.
Is possible that RMarkdown doesn't support


Installing a package is not enough — you need to load it. It’s possible that it works in your console because it was still loaded from before, or because you installed it in the current session.

To use the package, you need to add the following into your (R Markdown) code, before using any of its functions:


Alternatively, you can just prefix all its functions with reshape::. So, instead of calling melt, you’d call reshape::melt. That’s less commonly done but there’s nothing wrong with it.