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
0
votes
1 answer

Removing trials with >50% NA values from dataframe in long format

I have recorded pupil size in response to emotional vs. neutral sounds which were one of two colours and am working on preparing the data for growth curve analysis for which I need to remove trials with excess blinking and then interpolate the…
0
votes
1 answer

SAS transpose equivalent in R for lists

Data: set.seed(0) date <- rep(1:4,3) N <- length(date) A <- rnorm(N) B <- rnorm(N) C <- rnorm(N) mydata <- data.frame(date, A, B, C) date A B C 1 1 1.262954285 -1.1476570 -0.05710677 2…
Per
  • 577
  • 4
  • 7
0
votes
3 answers

In R use reshape package to use Names and Rownames as factors

Here is my data: 1999 2002 2005 2008 NON-ROAD 522.940 240.8469 248.9337 55.82356 NONPOINT 2107.625 1509.5000 1509.5000 1373.20731 ON-ROAD 346.820 134.3088 130.4304 88.27546 POINT 296.795 569.2600…
mjmiller1824
  • 23
  • 1
  • 5
0
votes
1 answer

import *.csv and merge the sheets

I need to import several *.csv sheets and afterwards I have to combine them. I have a Panel dataset with quarterly data over 100 periods, eleven countries and 20 variables. I have each variable as extra csv. My aim is to have a dataframe in the way…
René
  • 79
  • 8
0
votes
1 answer

Frequency analysis from time dependent data in R

I've got a time dependent data from animal recording. My data has two groups (TR and UT) each group has 20 replicate. Tiempo (time) variable goes from 282 sec to 318 sec. I have a turning point at 300 sec in which I turn on a light stimulus. I…
Matias Andina
  • 4,029
  • 4
  • 26
  • 58
0
votes
3 answers

Reshaping a csv in R a particular way

I have a CSV with a column format similar to this: Section | ID | Totaltime | Item1/Word | Item1/Cat | Item1/Time...Item235/Time I would like to reshape this so that instead of all 235 entries per ID on a single row, there is a row per item,…
0
votes
0 answers

Globbing files and turn them into single melted data frame with file name included

I have files that looks like this: $ head -n3 *.full.tsv ==> XOX.full.tsv <== Probe Index Gene Symbol log2(FC) pval CV 1427747_a_at Lcn2 5.205 1.098e-02 0.455 1449326_x_at Saa2 4.585 3.614e-04 0.788 ==> QUX.full.tsv…
pdubois
  • 7,640
  • 21
  • 70
  • 99
0
votes
1 answer

reshape2 & melt several successive columns of variables

I have a dataset that has one column for IDs and then 100 columns listing the scores for each of 100 questions, like so: ID Q1 Q2 ... Q100 S1 1 1 ... 1 I've written my code as follows: library(reshape2) new_df…
user4574145
0
votes
1 answer

Plot lines of bioclim data cross months

I have average bioclim values for temperature and precipitation at 28 locations, (like the dataset below) and I want to plot lines that connect the average values of each month for each data point (i.e. one line for each location across all…
0
votes
2 answers

How to melt a dataframe into multiple factors

I have been trying to plot a line plot with ggplot. My data looks something like this: I04 F04 I05 F05 I06 F06 CAT 3 12 2 6 6 20 DOG 0 0 0 0 0 0 BIEBER 1 0 0 1 0 0 and can be found here. Basically, we…
tumultous_rooster
  • 12,150
  • 32
  • 92
  • 149
0
votes
2 answers

Formatting a dataframe in R

I have a rather complicated task that I need to carry out so bear with me. I am guessing it will be possible, but let me know if not. Suppose I have the following data set.seed(123) date1 <- c(seq(as.Date("2011-11-1"),as.Date("2012-1-1"),by =…
theamateurdataanalyst
  • 2,794
  • 4
  • 38
  • 72
0
votes
1 answer

Python - get a dataframe with time as index and several dates as columns

I think I need some help with the "melt" function. I have a dataframe which looks like the following: As you can see the current index is time. However, if would like to achieve the following: Rationale behind is that I would like to compare the…
Johannes
  • 147
  • 3
  • 14
0
votes
1 answer

Create Lollipop-like plot with R

I have a .csv file that looks like…
user3401516
  • 103
  • 10
0
votes
2 answers

melting two unequal data frame into one in R

I have two excel files like this that i import as data frame x title1 title2 x title3 1 x y 1 j 2 a b 2 m 3 i j 3 y 4 m …
Masih
  • 920
  • 2
  • 19
  • 36
0
votes
1 answer

Date object giving errors in ggplot2 and dplyr, after using melt

I am facing an error with ggplot2 faceting and dplyr group_by when using a data frame with a date variable. This error only occurs if I first convert the date variable, then melt the data frame. If I do the opposite, the variable appears to be…
JG11235
  • 563
  • 3
  • 11