Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

R - could not find function 'melt()' [duplicate]

Tags:

r

Possible Duplicate:
Error: could not find function … in R

I find various references to the function melt(), actually melt.data.frame() in stackoverflow for R. But when I call it in R, it gives me

Error: could not find function "melt" 

How do I load that function so I can call it?

like image 852
Reactormonk Avatar asked Mar 18 '12 18:03

Reactormonk


People also ask

How do you get the melt function in R?

The melt function is to be found in the reshape package. If you do not have that package installed, then you will need to install it with install. packages("reshape") before you can use it. Then, when the package is installed, make it available with library(reshape) .

What does the function melt do in R?

R melt() function. The melt() function in R programming is an in-built function. It enables us to reshape and elongate the data frames in a user-defined manner. It organizes the data values in a long data frame format.


1 Answers

The melt function is to be found in the reshape package.

If you do not have that package installed, then you will need to install it with install.packages("reshape") before you can use it. Then, when the package is installed, make it available with library(reshape). At which point you are good to go!

Update 2018: The package in R 3.6.1. is now called reshape2.

The reshape2 notes also say:

reshape2 is retired: only changes necessary to keep it on CRAN will be made. We recommend using tidyr instead.

tidyr does not contain the melt function.

like image 161
David Heffernan Avatar answered Sep 19 '22 03:09

David Heffernan