Questions tagged [melt]

In R, the "melt" function from the "reshape2" and "data.table" (and earlier, "reshape") packages converts data into a long form. Melt is also a web application framework written in PHP.

In data processing, reshaping data to a long form where each row represents only one observation of one variable is often called "melting" the data, similar to UNPIVOT in some relational databases such as .

In , the function is part of the and packages (earlier, the "reshape" package).

This functionality is also found in similar data processing tools such as .

Related tags:

840 questions
-1
votes
1 answer

Going from pandas to pyspark - Convert dataframe with start and end date to daily data?

I have an ETL script using Pandas, and to make it more scalable I am trying to recreate it with Pyspark. Got everything going so far, but having issues with a particular transformation to a daily dataset. I have one record per ID with start date and…
L Xandor
  • 1,659
  • 4
  • 24
  • 48
-1
votes
1 answer

Re-shaping excel data

I am trying to re-shape the current excelsheet into a more proper "database" readable format. How can i do that? I have a read a few sample: reshape a pandas dataframe with multiple columns But the result is not working for me because of course my…
Hakumaru
  • 55
  • 5
-1
votes
2 answers

How to getRange in all cell appear when reshape data for wide to long form by monthly columns name GooglespreadSheet

In R , data.table library dcast() can transform dataset from wide to long shape ,how can i do this in googlespreadsheet? Sheet1 Name Type YTD JAN FEB MAR Product 1 A 8 1 3 4 Product 2 B 519 41 23 455 Product 3 C 32 2 25 …
rane
  • 901
  • 4
  • 12
  • 24
-1
votes
1 answer

Melting Data by Date Range

I'm running into an RStudio data issue regarding properly melting data. It currently is in the following form: Campaign, ID, Start Date, End Date, Total Number of Days, Total Spend, Total Impressions, Total Conversions I would like my data to look…
Marc
  • 9
  • 1
-1
votes
1 answer

Convert PySpark Dense Column Vectors into Rows

I have a data-frame with 3 columns and every entry is a dense vector of same length. How can I melt the Vector entries? Current data-frame: column1 | column2 …
smeisheri
  • 109
  • 1
  • 6
-1
votes
1 answer

Effectively Create a Matrix from a Dataframe for Large dataset

I am trying to create a matrix from a large dataframe. Here is a sample dataframe df <- data.frame(index=c("x","y","j","ww","rr","ff"), a=c(1,3,3,5,1,6), b=c(2,3,5,3,2,3), c=c(3,2,4,5,6,10), d…
user10316615
-1
votes
4 answers

Creating Stacked Bar Chart With one Variable for each Bar, using melt, and ggplot

This question is raising different points as the one I posted yesterday, with a better description, so I hope for your understanding. I have the following Data: Data <- data.frame(LMX = c(1.92, 2.33, 3.52, 5.34, 6.07, 4.23, 3.45, 5.64), Thriving =…
Andreas G.
  • 190
  • 11
-1
votes
1 answer

Add columns from different data frames and stack on two indicators

We’d like to merge some columns from a data frame with the matching columns from various different data frames. Our main data frame predict looks as follows: >predict x1 x2 x3 1 1 1 0 1 0 1 1 0 1 1 0 0 …
Dima
  • 146
  • 1
  • 1
  • 12
-1
votes
1 answer

python convert multiple lists to row for certain lists

I have the following dataframe : network date count2 count3 user2 user3 3 20170721 [6, 7] [1,3] [57,88] [47,58] 4 20170721 [6] [] [12] [] 43 20170721 [] [7,2] [] …
eleanor
  • 275
  • 4
  • 13
-1
votes
1 answer

How to sort data to a more friendly timeseries data after applying reshape melt()

I have the following data after melting using reshape2::melt() CustomerName variable value 1 Aaron Bergman 01-2009 0 2 Aaron Hawkins 01-2009 0 3 Aaron Smayling 01-2009 136 4 Adam Bellavance 01-2009 …
Nishant
  • 1,063
  • 13
  • 40
-1
votes
3 answers

combine multiple rows with same field in R

I have a dataset as following V1 <- c(5,5,5,45,45,77) V2 <- c("low", "low", "medium", "low", "low", "high") V3 <- c(10,3,6,10,3,1) df <- cbind.data.frame(V1,V3,V2) v1 v2 v3 5 10 low 5 3 low 5 6 …
arjun
  • 3
  • 1
-1
votes
1 answer

R: factors across columns as dummy variable

I am working in R and i need on below problem. I have my data in below format. Users Lang_1 Lang_2 Lang_3 Lang_4 Lang_5 user_1 C SAS Python SPSS Java user_2 R C++ Java user_3 SAS R Python Octave user_4 …
-1
votes
1 answer

melting hundreds of observations in column, of different length

I have some data that has been given to me and looks like this: each line is an experiment conducted, controling 5 variables (the first five columns) and gave results (readings) stored in the following (hundreds of) columns X, X1...etc. I would…
agenis
  • 8,069
  • 5
  • 53
  • 102
-1
votes
1 answer

How to cast and melt a data frame with 2 unique IDs

I have 2 data frame that I want to compare. (I've already asked this question here, but am phrasing it differently to make it more efficient: How to find differences in elements of 2 data frames based on 2 unique…
John M.
  • 323
  • 2
  • 5
  • 13
-2
votes
1 answer

How to reshape the data in R , apply top date row as column and group by id in

Hi i have the data like this date 2020/06/10 2020/06/10 2020/06/10 2020/06/11 2020/06/11 2020/06/11 id x y z x y z 10432 0 0 0 0 …
Aditya
  • 13
  • 5
1 2 3
55
56