juse juse - 1 year ago 187
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

Answer Source

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.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download