[R] Warning from reshape2 when melting a data frame with uneven number of columns.

Ashim Kapoor ashimkapoor at gmail.com
Sun Jun 4 12:48:16 CEST 2017


Here is a small reproducible example:

data <-
structure(list(V1 = structure(1:3, .Label = c("Name1", "Name2",
"Name3"), class = "factor"), V2 = structure(c(1L, 3L, 2L), .Label =
c("nam1",
"name-1", "name_12"), class = "factor"), V3 = structure(1:3, .Label =
c("nam2",
"nam_34", "name-2"), class = "factor"), V4 = structure(c(2L,
3L, 1L), .Label = c("", "nam3", "nam_56"), class = "factor"),
    V5 = structure(c(1L, 2L, 1L), .Label = c("", "name_78"), class =
"factor")), .Names = c("V1",
"V2", "V3", "V4", "V5"), class = "data.frame", row.names = c(NA,
-3L))

library(reshape2)
data_long <- melt(data,id.vars="V1")

Warning message:
attributes are not identical across measure variables; they will be dropped


Can someone please tell me how to correct this?

Best Regards,
Ashim

	[[alternative HTML version deleted]]



More information about the R-help mailing list