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
vote
3 answers

Shape a huge data.table (1,000,000 × 4,000 alias 8GB) from wide to long

There is this 8GB CSV file on my disk. It has one "match" per row. A "match" consists of some data like id, date, and winner. But it also has 10 players in it with all their data. Those are stored in participants.0.stats.visionScore,…
Matteo B.
  • 3,906
  • 2
  • 29
  • 43
1
vote
2 answers

Convert wide to long format using melt without column name in long format dataframe

I have a dataframe that looks like this I want the dataframe to be converted to long format like this This is the code I use long_ex <- melt(wide_ex, id.vars = 5, na.rm=TRUE) #wide_ex is wide format dataframe However, my end result looks like…
Jin
  • 527
  • 6
  • 21
1
vote
2 answers

Pandas dataframe use columns as rows

I have a dataframe with a columns for group and columns of answers of question: Group Q1 Q2 Q3 Q4 0 1 A B C 6 1 1 B C A A 2 1 E F V A 3 2 R T Y O 4 2 M Z D F And I want to move/melt/colapse the…
Cranjis
  • 1,590
  • 8
  • 31
  • 64
1
vote
1 answer

ggplot labels for melted dataframes

It's often the case I melt my dataframes to show multiple variables on one barplot. The goal is to create a geom_bar with one par for each variable, and one summary label for each bar. For example, I'll do…
Ben
  • 1,113
  • 10
  • 26
1
vote
0 answers

using melt function in groupby for large data sets in python

I have one data frame with 1782568 distinct groups. So, when i melt that data by grouping level my kernal got stuck. So, I am decided to to melt the data by group wise and then i will combine all of them sequentially. For that I wrote the following…
1
vote
1 answer

Reshape wide data in R: Converting two rows into columns

How do I transpose this dataset in R? See below: I downloaded a dataset that looks like this (the dates go backward from 2016 - 1975): V1 V2 V3 V4 V5 1 2016 …
POW123
  • 316
  • 1
  • 3
  • 12
1
vote
2 answers

Analyze simulated replicate of an experiment

I'm trying to simulate data for an experiment (learning purpose, self-taught) The purpose is to see how with the increase of distance (in cm) my variable decrease (I'm actually expecting that with the real data the decrease will be not linear). 5…
1
vote
1 answer

Convert columns to rows repeat common values

good people, I have a data frame that I want to transform as below from dataframe1 to dataframe2: dataframe1 <- data.frame(Company_Name = c("KFC", "McD"), Company_ID = c(1, 2), Company_Phone = c("237389",…
R noob
  • 495
  • 3
  • 20
1
vote
0 answers

Double Group Sum

Ciao, I have two columns. Every row represents one student. The first column tells what class the student is in. The second column tells if the student passed a exam. Here is my replicating example. This is the data I have…
bvowe
  • 3,004
  • 3
  • 16
  • 33
1
vote
1 answer

How to make a single histogram from grouped columns in R

I have the following dataset: year type count 1560 Person 2 1560 Public 1 1560 Thing 1 1578 Academic 1 1578 Public 1 1578 Thing 1 1582 Person 3 1582 Public 3 1582 Thing 3 ... My goal is…
pnine
  • 83
  • 1
  • 8
1
vote
3 answers

How to melt my dataframe in r

I have the below dataframe: num type f 1: 1 aa 0.8103 2: 1 ba 0.7500 3: 2 bb 0.8602 4: 3 bb 0.9017 5: 3 aa 0.6308 6: 3 cc 0.8491 I'd like to rearrange my data…
Bella
  • 937
  • 1
  • 13
  • 25
1
vote
1 answer

collapse pandas dataframe rows based on index column

I have a dataframe that contains information that is linked by an ID column. The rows are sequential with the odd rows containing a "start-point" and the even rows containing an "end" point. My goal is to collapse the data from these into a single…
1
vote
2 answers

mlt melt image slideshow from text file

On my site I have ffmpeg set up to convert a list of image paths from a text file into a slideshow like so -- My text looks something like this (actual file names are not sequential) - ffconcat version 1.0 file 'IMG.PNG' file 'IMG2.JPG' file…
730wavy
  • 944
  • 1
  • 19
  • 57
1
vote
1 answer

mlt melt slideshow with audio is not playing sound

I am trying to run a melt/mlt command and so far it seems to work EXCEPT there's no audio sound being played. I know the audio track is being added because the length of the video. Here's what I have -- melt \ placeholder.png length=200 \ inside.png…
730wavy
  • 944
  • 1
  • 19
  • 57
1
vote
0 answers

Melt function produced Error in match.names(clabs, names(xi))

I am trying to reshape my data using the melt function. I successfully did it once importing data from a csv file, but somehow when I tried to do to data from an xlsx file the error popped up. Here are my data PAR T27 T25.5 T24 T22.5 T21…
Rhyn
  • 135
  • 14